15.10.2010, 11:51
Hello, I am converting my script from dini to MySQL. This is the first time I used MySQL.
Here is my connect code:
That is called under GameModeInit.
Then, I have an IRC command called "!setmotd".
And the actually command to get the "MOTD":
I get errors in the MySQL log:
Help would be appreciated,
-SloPro.
P.S. I know I fail at MySQL
Here is my connect code:
pawn Код:
forward ConnectMySQL();
public ConnectMySQL()
{
if(mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS))
{
mysql_debug(1);
printf("[MYSQL]: Connection to `%s` succesful!",SQL_DB);
}
else
{
printf("[MYSQL]: [ERROR]: Connection to `%s` failed!",SQL_DB);
}
return 1;
}
Then, I have an IRC command called "!setmotd".
pawn Код:
CMD(setmotd)
{
if(IsOwner)
{
format(stri,sizeof(stri),"UPDATE `Vars` SET `params` = '%s' WHERE `variable` = 'MOTD'", params);
mysql_query(stri);
IRC_Say(gBotID, channel, "MOTD set.");
}
return 1;
}
pawn Код:
CMD(motd)
{
mysql_query("SELECT * FROM `Vars` WHERE `variable` = 'MOTD'", 1);
format(stri, sizeof(stri), "MOTD is: %s");
IRC_Say(gBotID, channel, stri);
return 1;
}
Код:
[13:50:50] >> mysql_query( Connection handle: 1 ) <- query called [13:50:50] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead) <- query fail [13:50:51] >> mysql_reconnect( Connection handle: 1 ) <- reconnect tried [13:50:51] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection) <- reconnect fail [13:50:51] CMySQLHandler::Connect() - Access denied for user '41_exotic'@'ks312869.kimsufi.com' (using password: YES) (Error ID: 1045) <- and fail again
-SloPro.
P.S. I know I fail at MySQL