SA-MP Forums Archive
Error ID: 1064, MySQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error ID: 1064, MySQL (/showthread.php?tid=392919)



Error ID: 1064, MySQL - JaKe Elite - 16.11.2012

Having problems.

Here

Код:
[06:33:13] CMySQLHandler::Query(INSERT INTO `rfxtable` ('user', 'IP', 'Password', 'AccId', 'NoPrivM', 'Clothes', 'MissionCompleted', 'AgentCard', 'Story', 'BankPin', 'BankWealth', 'Banned', 'AdminLevel', 'VIPLevel', 'Money', 'Score', 'Kills', 'Deaths') VALUES ('[Air]Jake_Hero', '127.0.0.1', SHA1('finnandjake'), '39', '0', '-1', ') - An error has occured. (Error ID: 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 ''user', 'IP', 'Password', 'AccId', 'NoPrivM', 'Clothes', 'MissionCompleted', 'Ag' at line 1)
To sleepy to explain all..

Ok i will make it fast, The problem is, It doesn't let me create a new table when i register, However it works just like nothing.., I want to fix this problem, But can't find any solution, I'm to sleepy to search in the whole website..

Can someone explain why i'm having this problem!!

pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new q[300], IP[16];
    GetPlayerIp(playerid, IP, 16);
    new c = pInfo[playerid][Clothes];
    new m = pInfo[playerid][MissionCompleted];
    new format2[41];
    format(format2, 41, "%s", pInfo[playerid][AgentCard]);
    new s = pInfo[playerid][Story];
    new pm = pInfo[playerid][NoPM];
    pInfo[playerid][AccID] = ServerInfo[AccID];
    new ac = pInfo[playerid][AccID];
    new bw = pInfo[playerid][BankWealth];
    new b = pInfo[playerid][Banned];
    new at = pInfo[playerid][Admin];
    new v = pInfo[playerid][Vip];
    new k = pInfo[playerid][Kills];
    new d = pInfo[playerid][Deaths];
    format(q, sizeof(q), "INSERT INTO `rfxtable` ('user', 'IP', 'Password', 'AccId', 'NoPrivM', 'Clothes', 'MissionCompleted', 'AgentCard', 'Story', 'BankPin', 'BankWealth', 'Banned', 'AdminLevel', 'VIPLevel', 'Money', 'Score', 'Kills', 'Deaths') VALUES ('%s', '%s', SHA1('%s'), '%d', '%d', '%d', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%d',  5000, 0, '%d')", GetName(playerid), IP, passwordstring, ac, pm, c, m, format2, s, bw, b, at, v, k, d);
    mysql_query(q);
    return 1;
}
And how to create Account ID system??


Re: Error ID: 1064, MySQL - ReneG - 16.11.2012

Remove the quotes around each field name.
pawn Код:
'user', 'IP', 'Password', 'AccId', 'NoPrivM', 'Clothes', 'MissionCompleted', 'AgentCard', 'Story', 'BankPin', 'BankWealth', 'Banned', 'AdminLevel', 'VIPLevel', 'Money', 'Score', 'Kills', 'Deaths'
In MySQL, those singular quotes are for enclosing varchars(strings).

For the account ID system, check out this gamemode. Also, for registering, you can only insert the fields you need (name and password), and then run an UPDATE query for the rest of the data.


Re: Error ID: 1064, MySQL - Jarnu - 16.11.2012

Exactly what VincentDunn said. You only have to use quotes ' ' with strings not with integers.
change your line to :

pawn Код:
format(q, sizeof(q), "INSERT INTO `rfxtable` (user, IP, Password, AccId, NoPrivM, Clothes, MissionCompleted, AgentCard,Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('%s', '%s', SHA1('%s'), %d, %d, %d, %d, '%s', %d, '%s', %d, %d, %d, %d,  5000, 0, %d)", GetName(playerid), IP, passwordstring, ac, pm, c, m, format2, s, bw, b, at, v, k, d);



Re: Error ID: 1064, MySQL - JaKe Elite - 16.11.2012

Done, But new problem..

Код:
Query(INSERT INTO `rfxtable` (user, IP, Password, AccId, NoPrivM, Clothes, MissionCompleted, AgentCard,Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('[Air]Jake', '127.0.0.1', SHA1('finnandjake'), 42, 0, -1, 0, '18606216783', 0, '', 0, 0, 0, 0,  5000, 0, 1)) - An error has occured. (Error ID: 1136, Column count doesn't match value count at row 1)



Re: Error ID: 1064, MySQL - ReneG - 17.11.2012

Код:
user, IP, Password, AccId, NoPrivM, Clothes, MissionCompleted, AgentCard,Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths
doesn't match

Код:
'[Air]Jake', '127.0.0.1', SHA1('finnandjake'), 42, 0, -1, 0, '18606216783', 0, '', 0, 0, 0, 0,  5000, 0, 1



Re: Error ID: 1064, MySQL - JaKe Elite - 17.11.2012

Wait i will edit my code when i go home,
I'm at cafe right now..


Re: Error ID: 1064, MySQL - JaKe Elite - 17.11.2012

New problem

pawn Код:
CMySQLHandler::Query(INSERT INTO `rfxtable` (user, IP, Password, NoPrivM, Clothes, MissionCompleted, AgentCard, Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('[Air]Jake', '127.0.0.1', SHA1('finnandjake'), '0', '-1', '0', '52', '', '0', '', '0', '0', '0', '1',  5000, 0, ') - An error has occured. (Error ID: 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 ''' at line 1)
Current code

pawn Код:
format(q, sizeof(q), "INSERT INTO `rfxtable` (user, IP, Password, NoPrivM, Clothes, MissionCompleted, AgentCard, Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('%s', '%s', SHA1('%s'), '%d', '%d', '%d', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%d',  5000, 0, '%d')", GetName(playerid), IP, passwordstring, pm, c, m, format2, s, bw, b, at, v, k, d);



Re: Error ID: 1064, MySQL - Jarnu - 17.11.2012

Again old thing remove QUOTES from all the integers ! " %d " or "%i"
pawn Код:
format(q, sizeof(q), "INSERT INTO `rfxtable` (user, IP, Password, NoPrivM, Clothes, MissionCompleted, AgentCard, Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('%s', '%s', SHA1('%s'), %d, %d, %d, %d, '%s',%d, '%s', %d, %d, %d,%d,  5000, 0, %d)", GetName(playerid), IP, passwordstring, pm, c, m, format2, s, bw, b, at, v, k, d);



Re: Error ID: 1064, MySQL - JaKe Elite - 17.11.2012

But after that..

pawn Код:
CMySQLHandler::Query(INSERT INTO `rfxtable` (user, IP, Password, NoPrivM, Clothes, MissionCompleted, AgentCard, Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('[Air]Jake', '127.0.0.1', SHA1('finnandjake'), 0, -1, 0, 50, '',0, '', 0, 0, 0, 1, 5000, 0, )) - An error has occured. (Error ID: 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 ')' at line 1)



Re: Error ID: 1064, MySQL - Jochemd - 17.11.2012

Quote:

CMySQLHandler::Query(INSERT INTO `rfxtable` (user, IP, Password, NoPrivM, Clothes, MissionCompleted, AgentCard, Story, BankPin, BankWealth, Banned, AdminLevel, VIPLevel, Money, Score, Kills, Deaths) VALUES ('[Air]Jake', '127.0.0.1', SHA1('finnandjake'), 0, -1, 0, 50, '',0, '', 0, 0, 0, 1, 5000, 0, )) - An error has occured. (Error ID: 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 ')' at line 1)

See the fat part.