Page 1 of 1

Cannot figure out this error

Posted: Tue Jun 22, 2010 12:46 pm
by SFTLOLZ
***

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 12:51 pm
by Aravinthan
For the header,

It must be placed before the HTML tag.

For the MYSQL,

Code: Select all

$result= "SELECT * FROM `comments` WHERE id = `$id`";
Must be:

Code: Select all

$result= "SELECT * FROM `comments` WHERE `id` = '$id'";

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 12:56 pm
by SFTLOLZ
Thanks for the response,

It is still returning this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home1/sftlolzc/public_html/likes.php on line 6

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 1:03 pm
by AbraCadaver
SFTLOLZ wrote:Thanks for the response,

It is still returning this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home1/sftlolzc/public_html/likes.php on line 6
No, look at what Aravinthan said about the query. Tick marks ` go around field names, quotes ' go around string values like $id. If you would carry on your or die() logic you would see that $result is not valid because your query failed.

Code: Select all

$result = "SELECT * FROM `comments` WHERE id = `$id`" or die(mysql_error());

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 1:09 pm
by SFTLOLZ
I did it, I did it by typing it in, then copy and pasting. Same error both times.

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 1:12 pm
by Aravinthan
Can you repost your code please?

Also make sure that there is a table colums with an field called id and a field called likes.

look for some type...

Re: Cannot figure out this error

Posted: Tue Jun 22, 2010 1:18 pm
by SFTLOLZ
I figured it out, thank you for your help.