function mysql_num_rows() determines the number of rows returned from a SELECT query statement. : mysql_num_rows « MySQL Database « PHP






function mysql_num_rows() determines the number of rows returned from a SELECT query statement.

 
Its syntax is: int mysql_num_rows (int result)

<?
@mysql_connect("localhost", "root","") or die("Could not connect to MySQL server!");
@mysql_select_db("mydatabase") or die("Could not select database!");
$query = "SELECT title FROM mytable WHERE title LIKE \"p%\"";
$result = mysql_query($query);

print "Total rows selected: ".mysql_num_rows($result);

mysql_close();
?>
  
  








Related examples in the same category

1.Listing All Rows and Fields in a Table
2.int mysql_num_rows ( resource result )
3.Finding the Number of Rows Returned by a SELECT Statement with mysql_num_rows()
4.mysql_num_rows.php