Page 1 of 1

SQL Error

Posted: Mon Jun 25, 2007 6:31 am
by DaDigi
Query2 failed: update `UserDetails` set gold=gold+, bank=bank- WHERE ID='46811' #/bank2.phpYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' bank=bank- WHERE ID='46811' #/bank2.php' at line 1
Warning: Cannot modify header information - headers already sent by (output started at /game/stargame/stargatewars.com/vsys.php:916) in /game/stargame/stargatewars.com/bank2.php on line 73


Got that while trying to withdraw 9bil out of my bank. I clicked the back button, and tried again, but did not get this error.

Just giving ya a heads up.

Re: SQL Error

Posted: Wed Jun 27, 2007 2:24 am
by Bullseye
I just had a sql error come up, which logged me out of the game, said conflict with username/password or something like that. Anyway logged back in and its fine, just very weird.

Re: SQL Error

Posted: Mon Nov 19, 2007 9:15 pm
by Scott
The bank error is when any non numeric value is entered. Admin I would suggest running the variable through intval(); before passing it to the sql that way even if a player enters say "give me more money!" intval returns 0 if the value passed to it is any thing but a number.

intval('12.34') returns 12
intval('-12') returns -12 though so watch out for neg values

function posintval($int){
$int = intval($int);
$int=$int<0?$int*-1:$int;
return $int
}
This will always return the positive value of the input.