Page 1 of 1

mysql_num_rows problem

Posted: Mon May 14, 2007 1:10 am
by itsmani1
I am having problem in this code. 1st line works fine but when it comes to 2nd line it gives me error.
any reason or solution

Code: Select all

$resxx = mysql_db_query($db,$qrxx,$cid) or die(mysql_error());
	echo mysql_num_rows($db,$resxx,$cid);
        exit;

Posted: Mon May 14, 2007 1:29 am
by John Cartwright
The manual
This function is deprecated, do not use this function. Use mysql_select_db() and mysql_query() instead.

Posted: Mon May 14, 2007 1:42 am
by AKA Panama Jack
And mysql_num_rows only takes ONE argument. The result set object. You are trying to pass three arguments.

Posted: Mon May 14, 2007 9:46 am
by Mirux

Code: Select all

$resxx = mysql_db_query($db,$qrxx,$cid) or die(mysql_error());
echo mysql_num_rows($db,$resxx,$cid);
exit;
That's your code, perhaps if you change it to:

Code: Select all

$resxx = mysql_db_query($db,$qrxx,$cid) or die(mysql_error());
$rows= mysql_num_rows($db,$resxx,$cid);
echo $rows; / it should print a number which is the number of rows your table has.
exit;
Let me know if this worked for you.

Posted: Mon May 14, 2007 5:05 pm
by John Cartwright
That won`t make a difference, the only thing you`ve done is assigned the value of mysql_num_rows to a variable.

Posted: Mon May 21, 2007 4:40 am
by itsmani1
well thanks