Jump to content

Recommended Posts

[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
Link to comment
https://forums.phpfreaks.com/topic/11732-weird-phpmysql/
Share on other sites

[!--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 in
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44401
Share on other sites

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
Link to comment
https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44432
Share on other sites

[!--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\" /]
Link to comment
https://forums.phpfreaks.com/topic/11732-weird-phpmysql/#findComment-44438
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.