Archive for July 10, 2008

Getting Query Record Count in PHP

Posted in MySQL, SQL, Software, Technology, php, programming with tags , , on July 10, 2008 by Joey

To get the record count returned by a query in PHP, use the mysql_num_rows function, as follows:

$user = $_POST["Username"];
$pass = $_POST["Password"];
$query = mysql_query(”call MyProcedure(’$user’,’$pass’)”) or die( mysql_error() );

echo mysql_num_rows($query);