jonw118 Posted November 20, 2008 Share Posted November 20, 2008 I am getting an error: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/***/public_html/projects/***/admin/inc/admin_info_class.php on line 180" ...that line's code is: $row=mysql_fetch_array($rs); It works fine on one of my other servers. Any thoughts would be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/ Share on other sites More sharing options...
xtopolis Posted November 20, 2008 Share Posted November 20, 2008 In your code that says something like $rs = mysql_query($something) add or die(mysql_error()); $rs = mysql_query($something) or die(mysql_error()); That should tell you why the query isn't getting processed correctly. This error usually points to the query not being successful. Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694053 Share on other sites More sharing options...
networkthis Posted November 20, 2008 Share Posted November 20, 2008 do you wish to give us an example of your query statement? Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694066 Share on other sites More sharing options...
jonw118 Posted November 20, 2008 Author Share Posted November 20, 2008 When I do that or die to get the exact error I get: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Line 1 is: <?php ----------------------------------------- The full query is: function allowed_user_category($mID){ $rs=mysql_query("select mem_ID,cat_ID FROM tbl_member WHERE mem_ID=$mID"); $row=mysql_fetch_array($rs) or die(mysql_error()); return $row["cat_ID"]; } Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694081 Share on other sites More sharing options...
corbin Posted November 20, 2008 Share Posted November 20, 2008 echo "select mem_ID,cat_ID FROM tbl_member WHERE mem_ID=$mID" and tell us what it says. Looks to me like mID is not numeric. Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694085 Share on other sites More sharing options...
haku Posted November 20, 2008 Share Posted November 20, 2008 I'm thinking mID is empty - if it was numeric, he would get an empty result, but right now he is getting a syntax result. And since the location he is being told to check is near '', it means that it is at the end of the query. Therefore, the last part of the query must be the problem, and probably looks like this: Where mem_id= Since there is no value after the equals sign, it's a throwing back an error. Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694197 Share on other sites More sharing options...
Adam Posted November 20, 2008 Share Posted November 20, 2008 "Looks to me like mID is not numeric." Think corbin was barking up the same tree.. Echo out the value of $mID to double check it has a valid value... Adam Quote Link to comment https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/#findComment-694208 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.