Phpfr3ak Posted August 12, 2011 Share Posted August 12, 2011 <?php include("server.php"); $sql = "UPDATE players SET points = points + 5 WHERE is_active = 1 ORDER BY score DESC LIMIT 50"; $sql = "INSERT INTO credit_logs(player_id,Description,amount,end_balance) VALUES ($playerID,top 50 finish,5,5)"; mysql_query($sql) or die(mysql_error()); echo "Prizes Paid" ?> Unsure as to why im getting; 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 'top 50 finish,5,5)' at line 1 sorry my php isnt too great any help would be great thanks. Quote Link to comment https://forums.phpfreaks.com/topic/244634-can-i-get-a-little-help-please/ Share on other sites More sharing options...
AyKay47 Posted August 12, 2011 Share Posted August 12, 2011 1. by setting 2 values to $sql, you are overiding the first sql string.. 2. you are receving this error because you have not wrapped your values in quotes.. the only time in sql that you do not need to wrap a value in quotes is if its an integer..and even then its not a bad idea to.. include("server.php"); $sql = "UPDATE players SET points = points + 5 WHERE is_active = 1 ORDER BY score DESC LIMIT 50"; $sql1 = "INSERT INTO credit_logs(player_id,Description,amount,end_balance) VALUES ('$playerID','top 50 finish',5,5)"; $query = mysql_query($sql) or die(mysql_error()); $query1 = mysql_query($sql1) or die(mysql_error()); if($query && $query1){ //if both queries are successful echo "Prizes Paid"; } Quote Link to comment https://forums.phpfreaks.com/topic/244634-can-i-get-a-little-help-please/#findComment-1256518 Share on other sites More sharing options...
Phpfr3ak Posted August 12, 2011 Author Share Posted August 12, 2011 Thanks for that i now get how i went about it wrong, will know in future most appreciated still getting an odd message: Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\EasyPHP-5.3.3\www\public_html\crons\payprizes.php on line 4 Any clue? i'll try and work it out for myself if not just a tad lost atm Quote Link to comment https://forums.phpfreaks.com/topic/244634-can-i-get-a-little-help-please/#findComment-1256524 Share on other sites More sharing options...
AyKay47 Posted August 12, 2011 Share Posted August 12, 2011 this normally means that you forgot a line terminator " ; " somewhere in your code.. check the end of line 3 Quote Link to comment https://forums.phpfreaks.com/topic/244634-can-i-get-a-little-help-please/#findComment-1256534 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.