Register/Login func. not being called [MySQL - Scratch]
#7

Quote:
Originally Posted by rickisme
Посмотреть сообщение
pawn Код:
[20:05:08] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1054) Unknown column '' in 'field list'
cause pInfo[playerid][pID] is NULL in this query :
pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (`ID`, `Online`, `Password`, `IP`, `Admin`, `Money` ,`Score` ,`SkinID`) VALUES ('%e', 0, `%s`, `%s`, 0, 0, 0, 299)", pInfo[playerid][pID], pInfo[playerid][pPass], IP[playerid]);
            mysql_tquery(MySQL, szQuery, "OnAccountRegister", "i", playerid);
So, how to fix it ? Simple, just remove `ID` from insert query like this
pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (`Online`, `Password`, `IP`, `Admin`, `Money` ,`Score` ,`SkinID`) VALUES (0, `%s`, `%s`, 0, 0, 0, 299)", pInfo[playerid][pPass], IP[playerid]);
            mysql_tquery(MySQL, szQuery, "OnAccountRegister", "i", playerid);

And make sure your `ID` column in table accounts is AUTO_INCREMENT
It is on A_I already, I think there is another error appearing now.. This is the mysql_log.

Код:
[20:43:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[20:43:47] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = '%e' LIMIT 1"
[20:43:47] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = 'j0ke", callback: "OnAccountCheck", format: "i"
[20:43:47] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[20:43:47] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 1.9 milliseconds
[20:43:47] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[20:43:47] [DEBUG] Calling callback "OnAccountCheck"..
[20:43:47] [DEBUG] cache_get_data - connection: 1
[20:43:47] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[20:43:50] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `accounts` (`Online`, `Password`, `IP`, `Admin`, `Mo", callback: "OnAccountRegister", format: "i"
[20:43:50] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[20:43:50] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1054) Unknown column '2F9959B230A44678DD2DC29F037BA1159F233AA9AB183CE3A0678EAAE002E5AA6F27F47144A1A4365116D3DB1B58EC47896623B92D85CB2F191705DAF11858B8' in 'field list'
[20:43:50] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)