Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result

I am getting the following error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a5846646/public_html/4fmemberprofile.php on line 87

The code generating error is:

[php]$memberprofile=$_POST[‘Color’];

//retrieves all information about the 4F member selected
$profile = mysql_query(“SELECT * FROM themighty4f2005 WHERE names=$memberprofile”);

$realprofile = mysql_fetch_array($profile);

// Display profile
$names = $realprofile[‘names’];
$photo = $realprofile[‘photo’];
$email = $realprofile[‘email’];
$phonenumber = $realprofile[‘phonenumber’];
$occupation = $realprofile[‘occupation’];
$currentlocation = $realprofile[‘currentlocation’];

echo “$names
$photo
$email
$phonenumber
$occupation
$currentlocation”;
[/php]

The specific code generating error is in red. PLEASE HELP!

Sorry the error is:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5846646/public_html/4fmemberprofile.php on line 93

Try this query
[php]$profile = mysql_query(“SELECT * FROM themighty4f2005 WHERE names=’$memberprofile’”);[/php]

Echo out the var I think its empty if the query still does not work

[php]
if(empty($_POST[‘Color’]) || $_POST[‘Color’] == null ){
echo ‘is empty no value for memberprofile varaiable’;
}else{
$memberprofile = $_POST[‘Color’];
echo 'memberprofile = '.$memberprofile;
}

[/php]

Thanks so much Noodles. It worked! The error took me so long to figure out and it was stressing. Again thanks. If you can, also answer my inquiry on creating a self-updating sidebar. Thanks in advance.

Sponsor our Newsletter | Privacy Policy | Terms of Service