MySQL - can't find error |
MySQL - can't find error |
WaxyChicken |
Mar 12 2013, 03:18 PM
Post
#1
|
Group: Members Posts: 2 Joined: 12-March 13 Member No.: 18,819 |
The Table:
CODE Field Type Collation Attributes Null Default Extra ID int(10) UNSIGNED No auto_increment username char(20) utf8_general_ci No BLANK character char(2) utf8_general_ci No 00 invLand char(115) utf8_general_ci No 000:99 FirstPlay char(4) utf8_general_ci No TRUE Bank int(20) UNSIGNED No 2000 NOTE: "BLANK" is a string, not a null or white spaces. it could just as well say "BOB" The Error: CODE Error occurred in [INSERT INTO 'PlayerSats' (username,character,FirstPlay) VALUES ('WaxyChicken','20','FALS')]: 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 ''PlayerSats' (username,character,FirstPlay) VALUES ('WaxyChicken','20','FALS')' at line 1 NOTE: the 20 should be treated as a string, not as a numeric value. (01 is valid, 1 is not), the name of the table "PlayerSats" is not a typo. The Code: CODE if ($Funct == "SETFIRSTPLAY") { $sql = "INSERT INTO $PlayerStats (username,character,FirstPlay) VALUES ('$username','$Char','FALS')"; mysql_query($sql) or die("Error occurred in [$sql]: " . mysql_error()); echo "SUCCESS"; } Any help would be appreciated |
WaxyChicken |
Mar 12 2013, 04:33 PM
Post
#2
|
Group: Members Posts: 2 Joined: 12-March 13 Member No.: 18,819 |
error found. "Character" is a reserved word in MySQL. changed it to "chrtr".
|
Frederiek |
Mar 13 2013, 03:40 AM
Post
#3
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
Also, shouldn't the VALUE 'FALS' rather need to be 'FALSE'?
|
Lo-Fi Version | Time is now: 28th March 2024 - 08:40 AM |