Jump to content
MakeWebGames

Insert error


newttster

Recommended Posts

Okay ... this is the error message that I am getting.

QUERY ERROR: 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 'release, heal, turns) VALUES ('', '46','1','46','117','kev8','200','200','200'' at line 1

Query was INSERT INTO slaveretrieval (retrieveid, masterid, userid, slaveid, slaveuserid, slavepword, release, heal, turns) VALUES ('', '46','1','46','117','kev8','200','200','200')

And here is the code:

<?PHP
include "globals.php";
$_GET['ID']=abs((int) $_GET['ID']);
$now=($db->fetch_row($db->query("SELECT * FROM slavemarket2 WHERE masterid = '{$_GET['ID']}'")));
$t=($db->fetch_row($db->query("SELECT turns FROM `users` WHERE `userid` = '{$now['userid']}' ")));
$masteruserid=($now['userid']);
$turns=($t['turns']);
if  ($now['jobstodo']=='Slavealleyruns')
{
if (!$_GET['ID'])
{
echo"Invalid input";
}
else
{
$db->query("INSERT INTO slaveretrieval (retrieveid, masterid, userid, slaveid, slaveuserid, slavepword, release, heal, turns) 
VALUES ('', '{$now['masterid']}','{$now['userid']}','{$now['slaveid']}','{$now['slaveuserid']}','{$now['slavepword']}','{$now['release']}','{$now['heal']}','{$t['turns']}')");
$db->query("UPDATE slavemarket2 SET release=release-{$now['release']}, heal=heal-{$now['heal']} WHERE masterid={$_GET['ID']}");
$db->query("UPDATE users SET turns=turns-{$t['turns']} WHERE userid={$masteruserid}");
echo"You have retrieved {$now['release']} releases, {$now['heal']} heals and {$turns} turns.<br />
<a href='slavemarket.php'>Back to the Slave Market</a><br />
<a href='explore.php'>Back to town</a>";
}
}
$h->endpage();
?>

 

Can anyone spot what the hell it is that is wrong with this? I'm sure, that as usual it is probably something obvious, but I'll be damned if I can find it.

And yes I have tried it without the quotes around the inserts as well, same error.

I just don't get it ... I could see if it weren't picking up any of the values but it gets all the values that it needs to.

Edited by newttster
Link to comment
Share on other sites

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.   Paste as plain text instead

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