Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/133442-not-a-valid-mysql-result-resource/
Share on other sites

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.

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"];

}

 

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.

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.