12.08.2013, 06:00
Hello, I am using StrickenKid 2.1.1's MySQL, and whenever I use it on my Linux host, provided by Volt-Host, I can connect to the MySQL server and all, but then I use the MySQL Function 'mysql_fetch_field()' and it will crash. This is crazy though, as it works just fine on my normal computer, which is Windows. I have tried many things to fix this, and nothing has helped.
CrashDetect;
[/code]
ShowLoginScreen removes the Welcome Textdraws, then it checks if the name of the account is found in our mysql db.
I have a variable 'MySQLCheckAcc', and it will do the query, but then when I try to use mysql_fetch_field(), to get the ID of the account, I guess it crashes.
ShowLoginScreen();
MySQLCheckAcc();
CrashDetect;
Код:
[23:18:46] [debug] #2 0000afd8 in ShowLoginScreen () from NA-RP.amx [23:18:46] [debug] #1 0000d830 in ?? () from NA-RP.amx [23:18:46] [debug] #0 ???????? in native mysql_fetch_field () from mysql.so [23:18:46] [debug] Backtrace (most recent call first): [23:18:46] [debug] Server crashed while executing NA-RP.amx
ShowLoginScreen removes the Welcome Textdraws, then it checks if the name of the account is found in our mysql db.
I have a variable 'MySQLCheckAcc', and it will do the query, but then when I try to use mysql_fetch_field(), to get the ID of the account, I guess it crashes.
ShowLoginScreen();
pawn Код:
PUB:ShowLoginScreen(playerid) {
new string[256];
TextDrawHideForPlayer(playerid, WelcomeTD[0]);
TextDrawHideForPlayer(playerid, WelcomeTD[1]);
TextDrawHideForPlayer(playerid, WelcomeTD[2]);
if(!MySQLCheckAcc(GPN(playerid))) {
format(string, 256, "Welcome to New Archon RP, %s.\nThis account is {FF0000}not{A9C4E4} registered.\nEnter the password you wish for your account to have.", GPN(playerid));
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "NA-RP: Registration", string, "Confirm", "Exit");
return 1;
}
format(string, 256, "Welcome back to New Archon RP, %s.\nThis account {00FF00}is{A9C4E4} registered.\nEnter the password to your account.", GPN(playerid));
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "NA-RP: Login", string, "Confirm", "Exit");
return 1;
}
pawn Код:
stock MySQLCheckAcc(params[]) {
new query[128], id[8];
mysql_real_escape_string(params, params);
format(query, 128, "SELECT `ID` FROM `Accounts` WHERE `Username` = '%s' LIMIT 1;", params);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows()) { mysql_fetch_field("ID", id); }
else { id = "0"; }
mysql_free_result();
return strval(id);
}