Problem MySQL saving, Bad Syntax
#1

I'm getting errors when the Saving part is being called and I don't know where I did something wrong. Can you tell me what is wrong with my code? (Sorry for the 2 posts, I'm a beginner in MySQL and its not so easy as a expected.)

pawn Код:
new query[1500];

    format(query, sizeof(query), "UPDATE `accounts` SET Admin = %d, Skin = %d, Team = %d, InHand = %d, InBank = %d, Score = %d, Kills = %d, Deaths = %d, Regular = %d, Donator = %d, CitySpawn = %d, SpeedUnit = %d, Plate = %s, Color1 = %d, Color2 = %d, AutoCorrect = %d, Hours = %d, Minutes %d, Seconds = %s WHERE `ID` = %d",
    Info[playerid][aLevel],
    Info[playerid][Skin],
    Info[playerid][Team],
    GetPlayerCash(playerid),
    Info[playerid][InBank],
    GetPlayerScore(playerid),
    Info[playerid][Kills],
    Info[playerid][Deaths],
    Info[playerid][Regular],
    Info[playerid][Donator],
    Info[playerid][CitySpawn],
    Info[playerid][SpeedUnit],
    Info[playerid][Plate],
    Info[playerid][Color1],
    Info[playerid][Color2],
    Info[playerid][AutoCorrect],
    Info[playerid][Hours],
    Info[playerid][Minutes],
    Info[playerid][Seconds],
    Info[playerid][SQLid]);

    mysql_function_query(g_Handle, query, false, "SendQuery", "");
The console error:


The MySQL log:
Код HTML:
[17:01:23] >> mysql_query_callback( Connection handle: 1 )
[17:01:23] Passing query UPDATE `accounts` SET Admin = 0, Skin = 266, Team = 2, InHand = 0, InBank = 0, Score = 0, Kills = 0, Deaths = 0, Regular = 0, Donator = 0, CitySpawn = 0, SpeedUnit = 0, Plate = , Color1 = 0, Color2 = 0, AutoCorrect = 0, Hours = 0, Minutes 0, Seconds =  WHERE `ID` = 1 | 
[17:01:23] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[17:01:23] OnQueryError() - Called.
Reply
#2

pawn Код:
, Minutes %d,
Something is wrong ...
Hope you find it
Reply
#3

SpeedUnit = 0, Plate = , Color1 = 0

Plate are null
Reply
#4

Plate = , -> Plate = "",
So its empty

Greetz
~ Kevin
Reply
#5

Quote:

, Seconds = %s

change to
Quote:

, Seconds = %d

Reply
#6

Thanks guys lol, I hate typos! But My plate is a string and when I try to save it I get Uknown Column 'PlateName' in 'field list'
Reply
#7

Quote:
Originally Posted by andrew2695
Посмотреть сообщение
Thanks guys lol, I hate typos! But My plate is a string and when I try to save it I get Uknown Column 'PlateName' in 'field list'
also just to remind you if you are going to save %s into a Database, make sure to add '' around it or else it'll not work either example: Something = '%s'
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)