magnetica Posted August 25, 2009 Share Posted August 25, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/ Share on other sites More sharing options...
Mark Baker Posted August 25, 2009 Share Posted August 25, 2009 WHERE yt_id == '$yt_id'"; should be WHERE yt_id = '$yt_id'"; SQL is not PHP Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/#findComment-906129 Share on other sites More sharing options...
magnetica Posted August 25, 2009 Author Share Posted August 25, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/#findComment-906134 Share on other sites More sharing options...
PFMaBiSmAd Posted August 25, 2009 Share Posted August 25, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/#findComment-906142 Share on other sites More sharing options...
magnetica Posted August 25, 2009 Author Share Posted August 25, 2009 I know it's probably simply but can you help? Thats hilarious, should have known Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/#findComment-906153 Share on other sites More sharing options...
Mark Baker Posted August 25, 2009 Share Posted August 25, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/171849-solved-unexpected-error-with-a-database-query/#findComment-906182 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.