Error ID: 1064, MySQL
#1

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??
Reply
#2

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.
Reply
#3

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);
Reply
#4

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)
Reply
#5

Код:
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
Reply
#6

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

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);
Reply
#8

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);
Reply
#9

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)
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)