[MySQL] Syntax error
#1

Hi guys,

These two queries are showing me syntax error and I have cross checked it many a times.
pawn Code:
forward SaveAccount(playerid);
public SaveAccount(playerid)
{
    new query1[128], query2[128];
    mysql_format(mysql, query1, sizeof(query1), "INSERT INTO `playerdata` Name = '%e', Pass = '%e', IP = '%e', Sex = '%d', Age = '%d' ", PlayerInfo[playerid][name], PlayerInfo[playerid][pass], PlayerInfo[playerid][IP], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pAge]);
    mysql_query(mysql, query1);
    mysql_format(mysql, query2, sizeof(query2), "INSERT INTO `playerdata` Medic = '%d', Mechanic = '%d', Athelete = '%d', Pilot = '%d', TestPassed = '%d', SkillSelected = '%d' ", PlayerInfo[playerid][pMedic], PlayerInfo[playerid][pAthelete], PlayerInfo[playerid][pMechanic], PlayerInfo[playerid][pPilot], PlayerInfo[playerid][pTestPassed], PlayerInfo[playerid][pSkillSelected]);
    mysql_query(mysql, query2);
}
LOG:
pawn Code:
18:22:28    CMySQLQuery::Execute    ERROR   (error #1064) Erreur de syntaxe prиs de 'Name = 'Player', Pass = 'fsa', IP = '127.0.0.1', Sex = '1', Age = '21'' а la ligne 1
18:22:28    CMySQLQuery::Execute    ERROR   (error #1064) Erreur de syntaxe prиs de 'Medic = '0', Mechanic = '0', Athelete = '1', Pilot = '0', TestPassed = '1', Skil' а la ligne 1
EDIT: For the second query I have even tried changing the query size to 2000 but still it is printing till Skil, which is incmoplete.
Reply
#2

Use it as:
pawn Code:
"INSERT INTO playerdata (... FIELDS HERE ...) VALUES (... VALUES HERE ...)"
Reply
#3

Much love man! It's working. +rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)