mysql syntax error
#1

pawn Код:
stock SavePlayerVehicle(vehicleid)
{
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `playercars` SET `car_Owner` = '%s', `car_ModelID` = '%d', `car_Locked` = '%d', `car_Color1` = '%d', `car_Color2` = '%d'", pVeh[vehicleid][car_Owner], pVeh[vehicleid][car_ModelID], pVeh[vehicleid][car_Locked], pVeh[vehicleid][car_Color1], pVeh[vehicleid][car_Color2]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_X` = '%f', `car_Y` = '%f', `car_Z` = '%f', `car_A` = '%f', `car_World` = '%d', `car_Interior` = '%d', `car_Plate` = '%s'", szQuery, pVeh[vehicleid][car_X], pVeh[vehicleid][car_Y], pVeh[vehicleid][car_Z], pVeh[vehicleid][car_A], pVeh[vehicleid][car_World], pVeh[vehicleid][car_Interior], pVeh[vehicleid][car_Plate]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Cash` = '%d', `car_Gun1` = '%d', `car_Gun2` = '%d', `car_Mats` = '%d', `car_Cocaine` = '%d', `car_Pot` = '%d', `car_Mod1` = '%d', `car_Mod2` = '%d'", szQuery, pVeh[vehicleid][car_Cash], pVeh[vehicleid][car_Gun1], pVeh[vehicleid][car_Gun2], pVeh[vehicleid][car_Mats], pVeh[vehicleid][car_Cocaine], pVeh[vehicleid][car_Pot], pVeh[vehicleid][car_Mod1], pVeh[vehicleid][car_Mod2]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Mod3` = '%d, `car_Mod4` = '%d', `car_Mod5` = '%d', `car_Mod6` = '%d', `car_Mod7` = '%d', `car_Mod8` = '%d', `car_Mod9` = '%d', `car_Mod10` = '%d'", szQuery, pVeh[vehicleid][car_Mod3], pVeh[vehicleid][car_Mod4], pVeh[vehicleid][car_Mod5], pVeh[vehicleid][car_Mod6], pVeh[vehicleid][car_Mod7], pVeh[vehicleid][car_Mod8], pVeh[vehicleid][car_Mod9], pVeh[vehicleid][car_Mod10]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Mod11` = '%d', `car_Mod12` = '%d', `car_Mod13` = '%d', `car_Mod14` = '%d', `car_Mod15` = '%d', `car_Mod16` = '%d', `car_Mod17` = '%d' WHERE `car_ID` = '%d'", szQuery, pVeh[vehicleid][car_Mod11], pVeh[vehicleid][car_Mod12], pVeh[vehicleid][car_Mod13], pVeh[vehicleid][car_Mod14], pVeh[vehicleid][car_Mod15], pVeh[vehicleid][car_Mod16], pVeh[vehicleid][car_Mod17], vehicleid);
    mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "i", THREAD_NO_RESULT);
    return 1;
}
Can anyone see anything wrong with that sql? I can't seem to spot it.
Reply
#2

Show us mysql logs
Reply
#3

its just a syntax error somewhere
Код:
[11:07:11] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '`playercars` WHERE `car_ID` = '1'' at line 1
[11:07:42] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '`playercars` WHERE `car_ID` = '2'' at line 1
[11:14:07] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:45:12] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:45:16] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:45:20] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:49:59] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:50:02] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:50:06] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:53:16] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:53:20] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:53:23] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:54:21] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:55:23] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:59:39] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:59:43] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
[11:59:46] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #1064) 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 '0', `car_Mod5` = '0', `car_Mod6` = '0', `car_Mod7` = '0', `car_Mod8` = '0', `car' at line 1
Reply
#4

you just missed a comma whatever it is " ' " in "`car_Mod3`= '%d "

try this
pawn Код:
stock SavePlayerVehicle(vehicleid)
{
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `playercars` SET `car_Owner` = '%s', `car_ModelID` = '%d', `car_Locked` = '%d', `car_Color1` = '%d', `car_Color2` = '%d'", pVeh[vehicleid][car_Owner], pVeh[vehicleid][car_ModelID], pVeh[vehicleid][car_Locked], pVeh[vehicleid][car_Color1], pVeh[vehicleid][car_Color2]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_X` = '%f', `car_Y` = '%f', `car_Z` = '%f', `car_A` = '%f', `car_World` = '%d', `car_Interior` = '%d', `car_Plate` = '%s'", szQuery, pVeh[vehicleid][car_X], pVeh[vehicleid][car_Y], pVeh[vehicleid][car_Z], pVeh[vehicleid][car_A], pVeh[vehicleid][car_World], pVeh[vehicleid][car_Interior], pVeh[vehicleid][car_Plate]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Cash` = '%d', `car_Gun1` = '%d', `car_Gun2` = '%d', `car_Mats` = '%d', `car_Cocaine` = '%d', `car_Pot` = '%d', `car_Mod1` = '%d', `car_Mod2` = '%d'", szQuery, pVeh[vehicleid][car_Cash], pVeh[vehicleid][car_Gun1], pVeh[vehicleid][car_Gun2], pVeh[vehicleid][car_Mats], pVeh[vehicleid][car_Cocaine], pVeh[vehicleid][car_Pot], pVeh[vehicleid][car_Mod1], pVeh[vehicleid][car_Mod2]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Mod3` = '%d', `car_Mod4` = '%d', `car_Mod5` = '%d', `car_Mod6` = '%d', `car_Mod7` = '%d', `car_Mod8` = '%d', `car_Mod9` = '%d', `car_Mod10` = '%d'", szQuery, pVeh[vehicleid][car_Mod3], pVeh[vehicleid][car_Mod4], pVeh[vehicleid][car_Mod5], pVeh[vehicleid][car_Mod6], pVeh[vehicleid][car_Mod7], pVeh[vehicleid][car_Mod8], pVeh[vehicleid][car_Mod9], pVeh[vehicleid][car_Mod10]);
    mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `car_Mod11` = '%d', `car_Mod12` = '%d', `car_Mod13` = '%d', `car_Mod14` = '%d', `car_Mod15` = '%d', `car_Mod16` = '%d', `car_Mod17` = '%d' WHERE `car_ID` = '%d'", szQuery, pVeh[vehicleid][car_Mod11], pVeh[vehicleid][car_Mod12], pVeh[vehicleid][car_Mod13], pVeh[vehicleid][car_Mod14], pVeh[vehicleid][car_Mod15], pVeh[vehicleid][car_Mod16], pVeh[vehicleid][car_Mod17], vehicleid);
    mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "i", THREAD_NO_RESULT);
    return 1;
}
Reply
#5

I did too! That'll probably be it, thanks mate. Couldn't spot it lol
Reply
#6

It's a large query, how large is szQuery? It's possible it's being cut off.
Reply
#7

Put this in that stock after whole formatting is done and show what it prints(whole line)
Quote:

printf("DEBUG : %s", szQuery);

EDIT; nvm didn't refreshed the page before posting so didn't saw above posts, sorry for this post
Reply
#8

Ew. Normalize your database already.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)