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

Solved, thanks for you help! =)
Reply
#2

Show us mysql_log.txt file which you will find in your server log..
Reply
#3

edit :
pawn Код:
mysql_connect( MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE, MYSQL_PASS);
to :
pawn Код:
MySQL = mysql_connect( MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE, MYSQL_PASS);
Recompile and try again
Reply
#4

Quote:
Originally Posted by rickisme
Посмотреть сообщение
edit :
pawn Код:
mysql_connect( MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE, MYSQL_PASS);
to :
pawn Код:
MySQL = mysql_connect( MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE, MYSQL_PASS);
Recompile and try again
Quote:
Originally Posted by BroZeus
Посмотреть сообщение
Show us mysql_log.txt file which you will find in your server log..
I did it, I checked the MySQL_Log and realized that I didn't defined the connectionHandle, However I'm getting Query error now and BTW the Registration Dialog pops up when i entered a password, it didn't continued. & I had a Query error in the mysql_log.txt

Here it is

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

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
Reply
#6

Too late.
Reply
#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
#8

^ That's because you use " ` " instead of " ' " in insert values
so just edit
`%s`, `%s`
to
'%s', '%s'
in the insert query
sorry for my bad english
Reply
#9

I've been wondering, which tutorial exactly teaches you to use backticks (`)? Most of the time you don't need them and it only adds to the confusion.
Reply
#10

Removed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)