PHP mysql_num_rows() Function
Complete PHP MySQL Reference
Definition and Usage
The mysql_num_rows() function returns the number of rows in a recordset.
This function returns FALSE on
failure.
Syntax
Parameter |
Description |
data |
Required. Specifies which data pointer to use. The data
pointer is the result from the mysql_query() function |
Example
<?php
$con = mysql_connect("localhost", "peter", "abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("test_db",$con);
$sql = "SELECT * FROM person";
$result = mysql_query($sql,$con);
echo mysql_num_rows($result);
mysql_close($con);
?>
|
The output of the code above could be:
Complete PHP MySQL Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|