This example illustrates how to count the rows of the table.
To understand how to count the number of rows in a table, we have created a sql_num_rows.php file. If you are not connected to the database, then create a connection first using mysql_connect("hostName", "userName", "Password") and mysql_select_db("databaseName", connectionObject). Now the query can be executed using mysql_query("SELECT * FROM tableName"). The number of rows are returned by the mysql_num_rows() method.
Source Code of sql_num_rows.php
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: January 20, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles