> I am wanting to do a count in PHP. I want to be able to count the number of > records from a given database and display this count on the page. Can this > be done using PHP or is the sql thing?
If you're using MySQL - I don't know if COUNT() is a part of SQL'92 - you can use SELECT COUNT(*) FROM table like this: <? echo mysql_result(mysql_query("SELECT COUNT(*) FROM table"),0,0); ?> The two zeros at the end means that mysql_result is to fetch the first row, the first column of the result. (Also, it'll be much faster than mysql_num_rows(mysql_query("SELECT * FROM table")) Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php