473,385 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

HOW TO GET HOW MANY RECORDS YOU HAVE IN DB

Hi,
I finally discover the way how to get what I need.

Let's look to my code:

----------------------- CODE ------------------------>

$res = @mysql_query("SELECT COUNT(*) AS ToT FROM table_name");
$dato = mysql_fetch_array($res);

echo($dato[ToT]);
----------------------- CODE ------------------------>

With this code you will get how much records do you have in DB.

PS:
Whan you think that everything is over and that you are at bottom of
trying push harder to see what is under.

Auron
http://eye.cc php newsgroups
Feb 21 '06 #1
2 1001
auron wrote:
Hi,
I finally discover the way how to get what I need.

Let's look to my code:

----------------------- CODE ------------------------>

$res = @mysql_query("SELECT COUNT(*) AS ToT FROM table_name");
$dato = mysql_fetch_array($res);

echo($dato[ToT]);
----------------------- CODE ------------------------>

With this code you will get how much records do you have in DB.

PS:
Whan you think that everything is over and that you are at bottom of
trying push harder to see what is under.

Auron
http://eye.cc php newsgroups


you should reply to your original post rather than starting a new thread!
Feb 21 '06 #2
auron wrote:
Hi,
I finally discover the way how to get what I need.

Let's look to my code:

----------------------- CODE ------------------------>

$res = @mysql_query("SELECT COUNT(*) AS ToT FROM table_name");
$dato = mysql_fetch_array($res);

echo($dato[ToT]);
----------------------- CODE ------------------------>

With this code you will get how much records do you have in DB.


I can shrink that down to a single line, though:

<?php
echo mysql_result(mysql_query("SELECT COUNT(*) FROM table_name"),0);
?>

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Feb 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Greg | last post by:
Hello, I've to manage many 'table' (having same scheme) on the same server. And I ask myself what could be the best to do (and if you know, why) : Creating as many database (the name would...
9
by: Simon Withers | last post by:
I have 3 data tables, A, B and C, with many to many relationship tables between A-B and A-C. The data in A and C changes rarely, and the A-C relationship relates all possible combinations of A...
5
by: Don Sealer | last post by:
I have a database that I need to track certain measurements numerous times per day. I need to record several aspects like, length, width, thickness, plus a few other things. I've been recording...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
8
by: Gem | last post by:
Hi I'm struggling with a query returning too many records. I have 3 related tables. tblPatients tblOperations tblTargets Each patient in tblPatients can have more than one operation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.