SQL Error

Locked
DaDigi
Forum Elder
Posts: 2358
Joined: Sun Nov 27, 2005 11:29 am
Alliance: I hate all equally
Race: Tri-athalon
ID: 46811
Location: Philadelphia, PA
Contact:

SQL Error

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.
DaDigi
Former Moderator for Market & Suggestions/Reports
User avatar
Bullseye
Forum Expert
Posts: 1229
Joined: Sat Apr 07, 2007 11:26 am
Alternate name(s): *Bullseye
Location: UK

Re: SQL Error

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.
Scott
Forum Newbie
Posts: 33
Joined: Mon Jul 17, 2006 7:03 am

Re: SQL Error

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

Return to “Bugs Archive”