Sartavius Posted October 7, 2011 Share Posted October 7, 2011 Okay, I have a table with two columns..'annoyed' and 'ignored'. I poulated 'annoyed' with Bob and 'ignored' with Sally. I ran the following test due to problems I was having in my main script and I get the old MySQL "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home2/testing_ig.php on line 16 Here is the code: <?php $DBhost = "localhost"; $DBuser = "xxxxx"; $DBpass = "xxxxx"; $DBName = "xxxxx"; $table = "ignore"; mysql_connect($DBhost,$DBuser,$DBpass) or die(); @mysql_select_db("$DBName") or die(); $ignorequery = "SELECT * FROM $table WHERE annoyed='Bob' AND ignored='Sally'"; $checkignore = mysql_query($ignorequery); $ifignored = mysql_num_rows($checkignore); //<--- This is line 16 if ($ifignored >= 1) { echo "exists"; } else { echo "doesn't exist"; } ?> I must be really tired because I'm not seeing the problem...? Quote Link to comment https://forums.phpfreaks.com/topic/248597-not-a-valid-result-resource-what/ Share on other sites More sharing options...
Sartavius Posted October 7, 2011 Author Share Posted October 7, 2011 Solved. Forgot that ignore is a reserved sql word. Quote Link to comment https://forums.phpfreaks.com/topic/248597-not-a-valid-result-resource-what/#findComment-1276657 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.