April 10th, 2000, 02:59 PM
What's the mysql code for counting the records in a table. I now have a php3 file with connect and select (it's all OK)
$records = mysql_numrows(mysql_query(SELECT * FROM penpals));
But this doesn't display the number of records in table "penpals". How could I do this?
April 10th, 2000, 05:58 PM
Your function is wrong. The function is:
Notice the additional underscore?
Also, you need to place quotes around your query:
$records = mysql_num_rows(mysql_query("SELECT * FROM penpals"));
The following results in a quicker query and less memory usage:
list($records)=mysql_fetch_row(mysql_query("select count(*) from penpals"));
April 11th, 2000, 12:34 AM
And what should be the whole php3 file with only a counter in it??? It doesn't work!
April 11th, 2000, 08:33 AM
do you mean: