birdie Posted June 11, 2006 Share Posted June 11, 2006 [code]$ip = $_SERVER['REMOTE_ADDR'];$sql = "SELECT * FROM portal_logintrys WHERE ip='$ip'";$query = mysql_query($sql);$numrows = mysql_num_rows($query);$object = mysql_fetch_object($query);[/code]I have done this hundreds of times but this script just doesnt seem to worry. no idea why. any help please Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/ Share on other sites More sharing options...
AndyB Posted June 11, 2006 Share Posted June 11, 2006 Do we get clues about what it does or doesn't do, or should we guess?Any errors? Is error_reporting on? Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44391 Share on other sites More sharing options...
birdie Posted June 11, 2006 Author Share Posted June 11, 2006 [!--quoteo(post=382624:date=Jun 11 2006, 09:11 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 11 2006, 09:11 PM) [snapback]382624[/snapback][/div][div class=\'quotemain\'][!--quotec--]Do we get clues about what it does or doesn't do, or should we guess?Any errors? Is error_reporting on?[/quote]sorry, [code]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource inWarning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44401 Share on other sites More sharing options...
AndyB Posted June 11, 2006 Share Posted June 11, 2006 Try displaying the error AND the query:[code]$query = mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql);[/code]That might point you in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44426 Share on other sites More sharing options...
WendyLady Posted June 11, 2006 Share Posted June 11, 2006 The "not a valid resource" error has been driving me up the wall recently.From what I can tell with my own code so far is that this really means, "I didn't manage to select/update/delete the thing you requested, and it's because you made an error in my code, silly". In other words, it didn't like your query somewhere.For me it usually means that SQL wanted parentheses somewhere, or a single quote around something, etc. Sometimes what works in one place doesn't work somewhere else (I would say there are gremlins somewhere in my database, but I am sure it has more to do with my relatively NOOBIE status as a PHP programmer).Wendy Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44432 Share on other sites More sharing options...
birdie Posted June 11, 2006 Author Share Posted June 11, 2006 [!--quoteo(post=382665:date=Jun 11 2006, 11:17 PM:name=WendyLady)--][div class=\'quotetop\']QUOTE(WendyLady @ Jun 11 2006, 11:17 PM) [snapback]382665[/snapback][/div][div class=\'quotemain\'][!--quotec--]The "not a valid resource" error has been driving me up the wall recently.From what I can tell with my own code so far is that this really means, "I didn't manage to select/update/delete the thing you requested, and it's because you made an error in my code, silly". In other words, it didn't like your query somewhere.For me it usually means that SQL wanted parentheses somewhere, or a single quote around something, etc. Sometimes what works in one place doesn't work somewhere else (I would say there are gremlins somewhere in my database, but I am sure it has more to do with my relatively NOOBIE status as a PHP programmer).Wendy[/quote]ooh thanks u two, ive just found out it was some dodgey code which i did earlier which interupted it a little. thanks anyway [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44438 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.