mysql_num_rows problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

mysql_num_rows problem

Post 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;
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

The manual
This function is deprecated, do not use this function. Use mysql_select_db() and mysql_query() instead.
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

And mysql_num_rows only takes ONE argument. The result set object. You are trying to pass three arguments.
Mirux
Forum Commoner
Posts: 29
Joined: Sun May 13, 2007 7:11 pm

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

well thanks
Post Reply