mysql_num_rows

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
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

mysql_num_rows

Post by psychotomus »

Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/interng8/public_html/credit-card-advice/partner/directory.php on line 241


Code: Select all

$pol = mysql_query("select * from lma_categories where parent = '".$tcat->id."' order by name limit $subcatsmainnum");
      	if (mysql_num_rows($pol) > 0) {
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mysql_error() may hold some information you may find useful.
ntbd
Forum Newbie
Posts: 21
Joined: Wed Apr 12, 2006 6:42 am

Post by ntbd »

If you know what the problem is just use '@' in front to run the function silently.

$n = @mysql_num_rows($query); will return a number if there is one and will report no errors if theres a problem.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It is not recommended to ever use the @ operator. Hiding errors does not change the fact that they still fire.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

what does this @ sign do?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

itsmani1 wrote:what does this @ sign do?
error display suppression. Note the error still fires, but the output of the firing may get hidden.
Post Reply