Is there a mysql command that will tell you how many total records are in a certain table?
mysql_num_rows () for php
select count(*) from table if you just wanna know from the db.
amc
$query=mysql_query("select * from $tablename"); $number_of_rows=mysql_numrows($query);
$tablename
echo "There are $number_of_rows records \o/";
Use this:
$query = mysql("SELECT * FROM table [I]WHERE something = 'something'[/I]", mysqlconn); $total_records = mysql_num_rows($query);
Happy new year
Wiseguy,
yea, select * from table would work, but very dangerous to do if all you need is a count, especially if you are dealing with a lot of data. And I'm not sure if mysql_numrows is right: I think mysql_num_rows is the correct way.
I tried to query with...
select billing(*);
to give me the total count in the table named "billing". It would not work...
See the MySQL manual - Chapter 3 is the tutorial. Section 3.3.4.8 is about "Counting Rows".