Mega Code Archive

 
Categories / Php / Code Snippets
 

Count and display the number of rows in a mysql database table

<?php Connect to the databasedb_connect(); // Query the database and get the count$result = mysql_query("SELECT * FROM tablename"); $num_rows = mysql_num_rows($result); // Display the resultsecho $num_rows;?>