mysql_num_rows(): supplied argument is not a valid

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
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

mysql_num_rows(): supplied argument is not a valid

Post by m2babaey »

Hi
can you see where the problem is:
code:

Code: Select all

function getrank($keyword, $listing){
$bid3=mysql_query("SELECT maxb FROM listing WHERE id='$listing'");
$bid4=mysql_fetch_array($bid3);
$mybid=$bid3['maxb'];
 $info5="SELECT * FROM listing WHERE keywords LIKE '%$keyword%' AND maxb > $mybid ";
 $info6=mysql_query($info5);
 $count_row =mysql_num_rows($info6);
 $rank = $count_row +1 ;
return $rank;
}
error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Query failed most likely. mysql_error() may tell you more...
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Post by m2babaey »

thanks
i was missing ' ' around $mybid
Post Reply