Jump to content

Archived

This topic is now archived and is closed to further replies.

magnetica

[SOLVED] Unexpected '=' error with a database query

Recommended Posts

Wasn't sure to post this in the mySql forum or here but gathered here as it's a Php error I am getting

 

Anyway so heres my if else statement

if(isset($_GET['yt_id'])){
	$yt_id = $_GET['yt_id'];
	mysql_query = "UPDATE videos SET thumbs_up = thumbs_up +1 WHERE yt_id == '$yt_id'";

			}

 

And heres the error

Parse error: syntax error, unexpected '=' in /home/a8129045/public_html/include/updatevote.php on line 13

 

Now obviously the mySql query is line 13. I know it's probably simply but can you help?

 

Thanks

Share this post


Link to post
Share on other sites
WHERE yt_id == '$yt_id'";

should be

WHERE yt_id = '$yt_id'";

SQL is not PHP

Share this post


Link to post
Share on other sites

Yea tried that but with the same error I even tried it with a static yt_id that I got from database.

Like so

 

WHERE yt_id = '12345'";

 

But still isn't working?

Share this post


Link to post
Share on other sites

mysql_query() is a function. You don't set it equal to a string that you want to query.

 

Please read the examples at this link - mysql_query

Share this post


Link to post
Share on other sites
mysql_query() is a function. You don't set it equal to a string that you want to query.
D***! Why didn't I spot that?

Share this post


Link to post
Share on other sites

×
×
  • 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.