lpxxfaintxx Posted January 26, 2009 Share Posted January 26, 2009 Very frustrating. I have echoed out $sessid and $friendid to make sure that data is indeed stored in those two variables. $query = mysql_query("SELECT * FROM friends WHERE username = '$sessid' AND friendname = '$friendid'") or die(mysql_error()); $result = mysql_query($query); $row = mysql_fetch_array($result); $num_results = mysql_num_rows($result); if ($num_results > 0){ $isfriend = 'y'; }else{ $isfriend = 'n'; } Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/q94/public_html/alumnify.com/profile.php on line 46 Any ideas? Thanks a bunch. Link to comment https://forums.phpfreaks.com/topic/142447-my-simple-query-is-not-working/ Share on other sites More sharing options...
clown[NOR] Posted January 26, 2009 Share Posted January 26, 2009 $query = "SELECT * FROM friends WHERE username='$sessid' AND friendname='$friendid'"; $result = mysql_query($query) or die(mysql_query()); $num_results = mysql_num_rows($result); if ($num_results > 0){ $row = mysql_fetch_array($result); $isfriend = 'y'; } else { $isfriend = 'n'; } you were trying to run mysql_query() on $result which allready contained the result of a string processed by mysql_query()[/code] Link to comment https://forums.phpfreaks.com/topic/142447-my-simple-query-is-not-working/#findComment-746350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.