MySql Syntax Error
#1

Code:

Код:
format(query, sizeof(query), "UPDATE `users` SET level = %d", PlayerInfo[playerid][pLevel]);
	format(query, sizeof(query), "%s, adminlevel = %d", query, PlayerInfo[playerid][pAdmin]);
	format(query, sizeof(query), "%s, helperlevel = %d", query, PlayerInfo[playerid][pHelper]);
	format(query, sizeof(query), "%s, donaterank = %d", query, PlayerInfo[playerid][pDonateRank]);
	format(query, sizeof(query), "%s, upgradepoints = %d", query, PlayerInfo[playerid][gPupgrade]);
	format(query, sizeof(query), "%s, connectedtime = %d", query, PlayerInfo[playerid][pConnectTime]);
	format(query, sizeof(query), "%s, registered = %d", query, PlayerInfo[playerid][pReg]);
	format(query, sizeof(query), "%s, sex = %d", query, PlayerInfo[playerid][pSex]);
	format(query, sizeof(query), "%s, age = %d", query, PlayerInfo[playerid][pAge]);
	format(query, sizeof(query), "%s, origin = %d", query, PlayerInfo[playerid][pOrigin]);
	format(query, sizeof(query), "%s, ck = %d", query, PlayerInfo[playerid][pCK]);
	format(query, sizeof(query), "%s, muted = %d", query, PlayerInfo[playerid][pMuted]);
	format(query, sizeof(query), "%s, respect = %d", query, PlayerInfo[playerid][pExp]);
	format(query, sizeof(query), "%s, money = %d", query, PlayerInfo[playerid][pCash]);
	format(query, sizeof(query), "%s, bank = %d", query, PlayerInfo[playerid][pAccount]);
	format(query, sizeof(query), "%s, crimes = %d", query, PlayerInfo[playerid][pCrimes]);
	format(query, sizeof(query), "%s, ggkills = %d", query, PlayerInfo[playerid][pggKills]);
	format(query, sizeof(query), "%s, ggkills2 = %d", query, PlayerInfo[playerid][pggKills2]);
	format(query, sizeof(query), "%s, ggdeaths = %d", query, PlayerInfo[playerid][pggDeaths]);
	format(query, sizeof(query), "%s, gglevel = %d", query, PlayerInfo[playerid][pggLevel]);
	format(query, sizeof(query), "%s, ingg = %d", query, PlayerInfo[playerid][pInGG]);
	format(query, sizeof(query), "%s, kills = %d", query, PlayerInfo[playerid][pKills]);
	format(query, sizeof(query), "%s, deaths = %d", query, PlayerInfo[playerid][pDeaths]);
	format(query, sizeof(query), "%s, arrested = %d", query, PlayerInfo[playerid][pArrested]);
	format(query, sizeof(query), "%s, wanteddeaths = %d", query, PlayerInfo[playerid][pWantedDeaths]);
	format(query, sizeof(query), "%s, phonebook = %d", query, PlayerInfo[playerid][pPhoneBook]);
	format(query, sizeof(query), "%s, lottonr = %d", query, PlayerInfo[playerid][pLottoNr]);
	format(query, sizeof(query), "%s, fishes = %d", query, PlayerInfo[playerid][pFishes]);
	format(query, sizeof(query), "%s, biggestfish = %d", query, PlayerInfo[playerid][pBiggestFish]);
	format(query, sizeof(query), "%s, job = %d", query, PlayerInfo[playerid][pJob]);
	format(query, sizeof(query), "%s, paycheck = %d", query, PlayerInfo[playerid][pPayCheck]);
	format(query, sizeof(query), "%s, headvalue = %d", query, PlayerInfo[playerid][pHeadValue]);
	format(query, sizeof(query), "%s, jailed = %d", query, PlayerInfo[playerid][pJailed]);
	format(query, sizeof(query), "%s, jailtime = %d", query, PlayerInfo[playerid][pJailTime]);
	format(query, sizeof(query), "%s, mutetime = %d", query, PlayerInfo[playerid][pMuteTime]);
	format(query, sizeof(query), "%s, materials = %d", query, PlayerInfo[playerid][pMats]);
	format(query, sizeof(query), "%s, drugs = %d", query, PlayerInfo[playerid][pDrugs]);
	format(query, sizeof(query), "%s, safemats = %d", query, PlayerInfo[playerid][pBoxMats]);
	format(query, sizeof(query), "%s, safedrugs = %d", query, PlayerInfo[playerid][pBoxDrugs]);
	format(query, sizeof(query), "%s, ddmanager = %d", query, PlayerInfo[playerid][pDM]);
	format(query, sizeof(query), "%s, ggdmanager = %d", query, PlayerInfo[playerid][pGGDM]);
    format(query, sizeof(query), "%s, ddticket = %d", query, PlayerInfo[playerid][pDTK]);
    format(query, sizeof(query), "%s, ddhmanager = %d", query, PlayerInfo[playerid][pDMH]);
    format(query, sizeof(query), "%s, ddhticket = %d", query, PlayerInfo[playerid][pDMHTK]);
   	format(query, sizeof(query), "%s, virworld = %d", query, PlayerInfo[playerid][pVirWorld]);
	format(query, sizeof(query), "%s, rob = %d", query, PlayerInfo[playerid][pRob]);
	format(query, sizeof(query), "%s, robskill = %d", query, PlayerInfo[playerid][pRobSkill]);
	format(query, sizeof(query), "%s, cashstolen = %d", query, PlayerInfo[playerid][pCashStolen]);
   	format(query, sizeof(query), "%s, wantedlevel = %d", query, WantedLevel[playerid]);
   	format(query, sizeof(query), "%s, wantedpoints = %d", query, WantedPoints[playerid]);
   	format(query, sizeof(query), "%s, healkit = %d", query, PlayerInfo[playerid][pKit]);
   	format(query, sizeof(query), "%s, ad = %d", query, PlayerInfo[playerid][pAD]);
	format(query, sizeof(query), "%s, carban = %d", query, PlayerInfo[playerid][pCarBan]);
   	format(query, sizeof(query), "%s, wipe = %d", query, PlayerInfo[playerid][pWipe]);
   	format(query, sizeof(query), "%s, adminsec = %d", query, PlayerInfo[playerid][pSec]);
   	format(query, sizeof(query), "%s, ticketcasino = %d", query, TicketCasino[playerid]);
	format(query, sizeof(query), "%s, warkills = %d", query, PlayerInfo[playerid][pWarKills]);
	format(query, sizeof(query), "%s, spawnloc = %d", query, PlayerInfo[playerid][pSpawnLoc]);
	format(query, sizeof(query), "%s, clubmember = %d", query, PlayerInfo[playerid][pClubMember]);				
	format(query, sizeof(query), "%s, bounty = %d", query, PlayerInfo[playerid][pBounty]);
	format(query, sizeof(query), "%s, specialadmin = %d", query, PlayerInfo[playerid][pSpecialAdmin]);
	format(query, sizeof(query), "%s, car = %d", query, PlayerInfo[playerid][pCar]);
	format(query, sizeof(query), "%s, car2 = %d", query, PlayerInfo[playerid][pCar2]);
	format(query, sizeof(query), "%s, scripter = %d", query, PlayerInfo[playerid][pScripter]);
	format(query, sizeof(query), "%s, clubleader = %d", query, PlayerInfo[playerid][pClubLeader]);
	format(query, sizeof(query), "%s, clubrank = %d", query, PlayerInfo[playerid][pClubRank]);
	format(query, sizeof(query), "%s, clubwarns = %d", query, PlayerInfo[playerid][pClubWarns]);
	format(query, sizeof(query), "%s, leader = %d", query, PlayerInfo[playerid][pLeader]);
	format(query, sizeof(query), "%s, member = %d", query, PlayerInfo[playerid][pMember]);
	format(query, sizeof(query), "%s, fmmember = %d", query, PlayerInfo[playerid][pFMember]);
	format(query, sizeof(query), "%s, rank = %d", query, PlayerInfo[playerid][pRank]);
	format(query, sizeof(query), "%s, char = %d", query, PlayerInfo[playerid][pChar]);
	format(query, sizeof(query), "%s, contracttime = %d", query, PlayerInfo[playerid][pContractTime]);
	format(query, sizeof(query), "%s, nfs = %d", query, PlayerInfo[playerid][pNFS]);
	format(query, sizeof(query), "%s, detskill = %d", query, PlayerInfo[playerid][pDetSkill]);
	format(query, sizeof(query), "%s, sexskill = %d", query, PlayerInfo[playerid][pSexSkill]);
	format(query, sizeof(query), "%s, boxskill = %d", query, PlayerInfo[playerid][pBoxSkill]);
	format(query, sizeof(query), "%s, lawskill = %d", query, PlayerInfo[playerid][pLawSkill]);
	format(query, sizeof(query), "%s, mechskill = %d", query, PlayerInfo[playerid][pMechSkill]);
	format(query, sizeof(query), "%s, jackskill = %d", query, PlayerInfo[playerid][pJackSkill]);
	format(query, sizeof(query), "%s, carskill = %d", query, PlayerInfo[playerid][pCarSkill]);
	format(query, sizeof(query), "%s, newsskill = %d", query, PlayerInfo[playerid][pNewsSkill]);
	format(query, sizeof(query), "%s, drugsskill = %d", query, PlayerInfo[playerid][pDrugsSkill]);
	format(query, sizeof(query), "%s, cookskill = %d", query, PlayerInfo[playerid][pCookSkill]);
	format(query, sizeof(query), "%s, fishskill = %d", query, PlayerInfo[playerid][pFishSkill]);
	format(query, sizeof(query), "%s, pshealth = %.1f", query, PlayerInfo[playerid][pSHealth]);
	format(query, sizeof(query), "%s, phealth = %.1f", query, PlayerInfo[playerid][pHealth]);
	format(query, sizeof(query), "%s, int = %d", query, PlayerInfo[playerid][pInt]);
	format(query, sizeof(query), "%s, local = %d", query, PlayerInfo[playerid][pLocal]);
	format(query, sizeof(query), "%s, team = %d", query, PlayerInfo[playerid][pTeam]);
	format(query, sizeof(query), "%s, model = %d", query, PlayerInfo[playerid][pModel]);
	format(query, sizeof(query), "%s, phonenr = %d", query, PlayerInfo[playerid][pPnumber]);
	format(query, sizeof(query), "%s, house = %d", query, PlayerInfo[playerid][pPhousekey]);
	format(query, sizeof(query), "%s, bizz = %d", query, PlayerInfo[playerid][pPbiskey]);
	format(query, sizeof(query), "%s, pos_x = %.1f", query, PlayerInfo[playerid][pPos_x]);
	format(query, sizeof(query), "%s, pos_y = %.1f", query, PlayerInfo[playerid][pPos_y]);
	format(query, sizeof(query), "%s, pos_z = %.1f", query, PlayerInfo[playerid][pPos_z]);
	format(query, sizeof(query), "%s, carlic = %d", query, PlayerInfo[playerid][pCarLic]);
	format(query, sizeof(query), "%s, flylic = %d", query, PlayerInfo[playerid][pFlyLic]);
	format(query, sizeof(query), "%s, boatlic = %d", query, PlayerInfo[playerid][pBoatLic]);
	format(query, sizeof(query), "%s, fishlic = %d", query, PlayerInfo[playerid][pFishLic]);
	format(query, sizeof(query), "%s, gunlic = %d", query, PlayerInfo[playerid][pGunLic]);
	format(query, sizeof(query), "%s, gun1 = %d", query, PlayerInfo[playerid][pGun1]);
	format(query, sizeof(query), "%s, gun2 = %d", query, PlayerInfo[playerid][pGun2]);
	format(query, sizeof(query), "%s, gun3 = %d", query, PlayerInfo[playerid][pGun3]);
	format(query, sizeof(query), "%s, gun4 = %d", query, PlayerInfo[playerid][pGun4]);
	format(query, sizeof(query), "%s, ammo1 = %d", query, PlayerInfo[playerid][pAmmo1]);
	format(query, sizeof(query), "%s, ammo2 = %d", query, PlayerInfo[playerid][pAmmo2]);
	format(query, sizeof(query), "%s, ammo3 = %d", query, PlayerInfo[playerid][pAmmo3]);
	format(query, sizeof(query), "%s, ammo4 = %d", query, PlayerInfo[playerid][pAmmo4]);
	format(query, sizeof(query), "%s, cartime = %d", query, PlayerInfo[playerid][pCarTime]);
	format(query, sizeof(query), "%s, payday = %d", query, PlayerInfo[playerid][pPayDay]);
	format(query, sizeof(query), "%s, paydayhad = %d", query, PlayerInfo[playerid][pPayDayHad]);
	format(query, sizeof(query), "%s, cdplayer = %d", query, PlayerInfo[playerid][pCDPlayer]);
	format(query, sizeof(query), "%s, wins = %d", query, PlayerInfo[playerid][pWins]);
	format(query, sizeof(query), "%s, loses = %d", query, PlayerInfo[playerid][pLoses]);
	format(query, sizeof(query), "%s, alcoholperk = %d", query, PlayerInfo[playerid][pAlcoholPerk]);
	format(query, sizeof(query), "%s, drugperk = %d", query, PlayerInfo[playerid][pDrugPerk]);
	format(query, sizeof(query), "%s, miserperk = %d", query, PlayerInfo[playerid][pMiserPerk]);
	format(query, sizeof(query), "%s, painperk = %d", query, PlayerInfo[playerid][pPainPerk]);
	format(query, sizeof(query), "%s, traderperk = %d", query, PlayerInfo[playerid][pTraderPerk]);
	format(query, sizeof(query), "%s, tutorial = %d", query, PlayerInfo[playerid][pTut]);
	format(query, sizeof(query), "%s, mission = %d", query, PlayerInfo[playerid][pMissionNr]);
	format(query, sizeof(query), "%s, warnings = %d", query, PlayerInfo[playerid][pWarns]);
	format(query, sizeof(query), "%s, facwarns = %d", query, PlayerInfo[playerid][pFACWarns]);
	format(query, sizeof(query), "%s, adjustable = %d", query, PlayerInfo[playerid][pAdjustable]);
	format(query, sizeof(query), "%s, fuel = %d", query, PlayerInfo[playerid][pFuel]);
	format(query, sizeof(query), "%s, married = %d", query, PlayerInfo[playerid][pMarried]);
	format(query, sizeof(query), "%s, marriedto = %s WHERE `id` = %d", query, PlayerInfo[playerid][pMarriedTo], PlayerInfo[playerid][pSQLid]);
Error:

Код:
[23:24:54] 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 'char = 0, contracttime = 0, nfs = 0, detskill = 0, sexskill = 0, boxskill = 0, l' at line 1
[23:24:54] 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 'char = 0, contracttime = 0, nfs = 0, detskill = 0, sexskill = 0, boxskill = 0, l' at line 1
Full Query Sequence:
Код:
[23:24:54] ProcessQueryThread(SendQuery) - Executing query UPDATE `users` SET level = 1, adminlevel = 0, helperlevel = 0, donaterank = 0, upgradepoints = 0, connectedtime = 0, registered = 1, sex = 1, age = 18, origin = 2, ck = 0, muted = 0, respect = 4, money = 1000, bank = 50000, crimes = 0, ggkills = 0, ggkills2 = 0, ggdeaths = 0, gglevel = 0, ingg = 0, kills = 0, deaths = 0, arrested = 0, wanteddeaths = 0, phonebook = 0, lottonr = 0, fishes = 0, biggestfish = 0, job = 0, paycheck = 15, headvalue = 0, jailed = 0, jailtime = 0, mutetime = 0, materials = 0, drugs = 0, safemats = 0, safedrugs = 0, ddmanager = 0, ggdmanager = 0, ddticket = 0, ddhmanager = 0, ddhticket = 0, virworld = 0, rob = 0, robskill = 0, cashstolen = 0, wantedlevel = 0, wantedpoints = 0, healkit = 0, ad = 0, carban = 0, wipe = 0, adminsec = 0, ticketcasino = 0, warkills = 0, spawnloc = 1, clubmember = 0, bounty = 0, specialadmin = 0, car = 9999, car2 = 9999, scripter = 0, clubleader = 0, clubrank = 0, clubwarns = 0, leader = 0, member = 0, fmmember = 255, rank = 0, char = 0, contracttime = 0, nfs = 0, detskill = 0, sexskill = 0, boxskill = 0, lawskill = 0, mechskill = 0, jackskill = 0, carskill = 0, newsskill = 0, drugsskill = 0, cookskill = 0, fishskill = 0, pshealth = 0.0, phealth = 100.0, int = 0, local = 255, team = 3, model = 264, phonenr = 4848, house = 255, bizz = 255, pos_x = 486.8, pos_y = -1491.4, pos_z = 20.0, carlic = 1, flylic = 0, boatlic = 0, fishlic = 0, gunlic = 0, gun1 = 0, gun2 = 0, gun3 = 0, gun4 = 0, ammo1 = 0, ammo2 = 0, ammo3 = 0, ammo4 = 0, cartime = 0, payday = 0, paydayhad = 0, cdplayer = 0, wins = 0, loses = 0, alcoholperk = 0, drugperk = 0, miserperk = 0, painperk = 0, traderperk = 0, tutorial = 1, mission = 0, warnings = 0, facwarns = 0, adjustable = 1, fuel = 0, married = 0, marriedto = No-one WHERE `id` = 1...
I really don't see what I forgot or miss placed...
Reply
#2

http://developer.mimer.se/validator/...rved-words.tml

also use mysql_format
Reply
#3

That's say validator:

Код:
	

Mimer SQL-2003 Validator

Check your SQL against the SQL-2003 standard using the Mimer SQL Validator 2003.

The SQL-2003 Validator!

Enter your SQL statement(s) in the box below and simply click the "Test SQL" button:
UPDATE `users` SET level = 1, adminlevel = 0, helperlevel = 0, donaterank = 0, upgradepoints = 0, connectedtime = 0, registered = 1, sex = 1, age = 18, origin = 2, ck = 0, muted = 0, respect = 4, money = 1000, bank = 50000, crimes = 0, ggkills = 0, ggkills2 = 0, ggdeaths = 0, gglevel = 0, ingg = 0, kills = 0, deaths = 0, arrested = 0, wanteddeaths = 0, phonebook = 0, lottonr = 0, fishes = 0, biggestfish = 0, job = 0, paycheck = 15, headvalue = 0, jailed = 0, jailtime = 0, mutetime = 0, materials = 0, drugs = 0, safemats = 0, safedrugs = 0, ddmanager = 0, ggdmanager = 0, ddticket = 0, ddhmanager = 0, ddhticket = 0, virworld = 0, rob = 0, robskill = 0, cashstolen = 0, wantedlevel = 0, wantedpoints = 0, healkit = 0, ad = 0, carban = 0, wipe = 0, adminsec = 0, ticketcasino = 0, warkills = 0, spawnloc = 1, clubmember = 0, bounty = 0, specialadmin = 0, car = 9999, car2 = 9999, scripter = 0, clubleader = 0, clubrank = 0, clubwarns = 0, leader = 0, member = 0, fmmember = 255, rank = 0, char = 0, contracttime = 0, nfs = 0, detskill = 0, sexskill = 0, boxskill = 0, lawskill = 0, mechskill = 0, jackskill = 0, carskill = 0, newsskill = 0, drugsskill = 0, cookskill = 0, fishskill = 0, pshealth = 0.0, phealth = 100.0, int = 0, local = 255, team = 3, model = 264, phonenr = 4848, house = 255, bizz = 255, pos_x = 486.8, pos_y = -1491.4, pos_z = 20.0, carlic = 1, flylic = 0, boatlic = 0, fishlic = 0, gunlic = 0, gun1 = 0, gun2 = 0, gun3 = 0, gun4 = 0, ammo1 = 0, ammo2 = 0, ammo3 = 0, ammo4 = 0, cartime = 0, payday = 0, paydayhad = 0, cdplayer = 0, wins = 0, loses = 0, alcoholperk = 0, drugperk = 0, miserperk = 0, painperk = 0, traderperk = 0, tutorial = 1, mission = 0, warnings = 0, facwarns = 0, adjustable = 1, fuel = 0, married = 0, marriedto = No-one WHERE `id` = 1
	See Validator Examples

Result:
UPDATE `users` SET level = 1, adminlevel = 0, helperlevel = 0, donaterank = 0, upgradepoints = 0, connectedtime = 0, registered = 1, sex = 1, age = 18, origin = 2, ck = 0, muted = 0, respect = 4, money = 1000, bank = 50000, crimes = 0, ggkills = 0, ggkills2 = 0, ggdeaths = 0, gglevel = 0, ingg = 0, kills = 0, deaths = 0, arrested = 0, wanteddeaths = 0, phonebook = 0, lottonr = 0, fishes = 0, biggestfish = 0, job = 0, paycheck = 15, headvalue = 0, jailed = 0, jailtime = 0, mutetime = 0, materials = 0, drugs = 0, safemats = 0, safedrugs = 0, ddmanager = 0, ggdmanager = 0, ddticket = 0, ddhmanager = 0, ddhticket = 0, virworld = 0, rob = 0, robskill = 0, cashstolen = 0, wantedlevel = 0, wantedpoints = 0, healkit = 0, ad = 0, carban = 0, wipe = 0, adminsec = 0, ticketcasino = 0, warkills = 0, spawnloc = 1, clubmember = 0, bounty = 0, specialadmin = 0, car = 9999, car2 = 9999, scripter = 0, clubleader = 0, clubrank = 0, clubwarns = 0, leader = 0, member = 0, fmmember = 255, rank = 0, char = 0, contracttime = 0, nfs = 0, detskill = 0, sexskill = 0, boxskill = 0, lawskill = 0, mechskill = 0, jackskill = 0, carskill = 0, newsskill = 0, drugsskill = 0, cookskill = 0, fishskill = 0, pshealth = 0.0, phealth = 100.0, int = 0, local = 255, team = 3, model = 264, phonenr = 4848, house = 255, bizz = 255, pos_x = 486.8, pos_y = -1491.4, pos_z = 20.0, carlic = 1, flylic = 0, boatlic = 0, fishlic = 0, gunlic = 0, gun1 = 0, gun2 = 0, gun3 = 0, gun4 = 0, ammo1 = 0, ammo2 = 0, ammo3 = 0, ammo4 = 0, cartime = 0, payday = 0, paydayhad = 0, cdplayer = 0, wins = 0, loses = 0, alcoholperk = 0, drugperk = 0, miserperk = 0, painperk = 0, traderperk = 0, tutorial = 1, mission = 0, warnings = 0, facwarns = 0, adjustable = 1, fuel = 0, married = 0, marriedto = No-one WHERE `id` = 1
       ^     ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^-----                                ^---                                                                                                                                                                                                                                   ^--      ^----                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^-           ^  ^
syntax error: ` users
  correction: users
syntax error: `
  correction: <identifier>
syntax error: member
  correction: <identifier>
syntax error: char
  correction: <identifier>
syntax error: int
  correction: <identifier>
syntax error: , local
  correction: AT local
syntax error: No
  correction: NOT
syntax error: ` id
  correction: id
syntax error: ` =
  correction: =
I'm still confused about this issue ...
Reply
#4

Try change char name.
I got the same problem with the word 'on'.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)