Friday, July 31, 2009

How do you determine the number of rows in a mySQL table with PHP?

I want to determine the number of rows in a mySQL table and store it in a variable. Could someone please help me with the syntax?

How do you determine the number of rows in a mySQL table with PHP?
Just use the query "select count(*) as total from tablename" and it will return a result set where the field is called "total" and contains the number of rows from the table.





Edit: You could also use mysql_num_rows(result). I have provided the link for it below.





Enjoy!


No comments:

Post a Comment