Count and display the number of rows in a mysql database table
This code will count the number of rows (entries / records) in a MySQL database table and then display it using echo on the screen.
Datebase connection code goes here.
If you don't know how to do it, see:
Change tablename to match the name of your own table
// Connect to the database
// Query the database and get the count
$result = mysql_query("SELECT * FROM tablename");
$num_rows = mysql_num_rows($result);
// Display the results
Get the code
Download the file to your computer: Click here to get the file