SA-MP Forums Archive
[Help] MySQL insert query (error) - 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: [Help] MySQL insert query (error) (/showthread.php?tid=610157)



[Help] MySQL insert query (error) - SteeLFelna - 20.06.2016

I have an error in MySQL insert query:
Код HTML:
ERROR:CMySQLQuery::Execute[OnPlayerRegister]
MESSAGE:(error #1054) Unknown column 'email' in 'field list'
Part of the code:
Код:
new 
        query[512], hashed_pass[129];

WP_Hash(hashed_pass, sizeof(hashed_pass), PlayerData[playerid][Password]);

mysql_format(MySQL_Handle, query, sizeof query, "INSERT INTO `players` SET \
    `name` = '%e',\
    `email` = '%e',\
    `password` = '%s',\
    `country` = '%d',\
    `age` = '%d'", 
PlayerData[playerid][Name], PlayerData[playerid][Email], hashed_pass, 
PlayerData[playerid][Country], PlayerData[playerid][Age]);

mysql_tquery(MySQL_Handle, query, "OnPlayerRegister", "d", playerid);
What is the problem? I tried to throw 'email' field, but the error was not repair, it is still there, but this time for 'country' field.

DB structure of `players` table:



Re: [Help] MySQL insert query (error) - Stinged - 20.06.2016

The format of INSERT INTO is:
Код:
INSERT INTO table (String1, String2, Int1...) VALUES ('%e', '%e', %i)



Re: [Help] MySQL insert query (error) - SteeLFelna - 20.06.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
The format of INSERT INTO is:
Код:
INSERT INTO table (String1, String2, Int1...) VALUES ('%e', '%e', %i)
I know, but and with this format, same error is happend.


Re: [Help] MySQL insert query (error) - GhostHacker - 20.06.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
The format of INSERT INTO is:
Код:
INSERT INTO table (String1, String2, Int1...) VALUES ('%e', '%e', %i)
Read this post no 2 https://sampforum.blast.hk/showthread.php?tid=609261&page=3