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