Jump to content

Recommended Posts

<?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.

 

Link to comment
https://forums.phpfreaks.com/topic/244634-can-i-get-a-little-help-please/
Share on other sites

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";
}

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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