mysql_tquery doesnt work - 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: mysql_tquery doesnt work (
/showthread.php?tid=599210)
mysql_tquery doesnt work -
Aa12 - 22.01.2016
mysql slowly kills me, lol
Код:
public OnPlayerConnect(playerid)
{
TogglePlayerSpectating(playerid, true);
new query[128], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `accounts` `Name` = '%e' LIMIT 1", playername);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
return 1;
}
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
print("check");
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_field_content(0, "Password", Player[playerid][Password], mysql, 129);
Player[playerid][ID] = cache_get_field_content_int(0, "ID");
ShowPlayerDialog(playerid, Log, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, Reg, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit");
}
return true;
}
when player connect I dont get print "check"
Re: mysql_tquery doesnt work -
Vince - 22.01.2016
In your MySQL log file you WILL find this snippet:
Код:
check the manual that corresponds to your MySQL server version for the right syntax to use near '`Name`'
Because you have forgotten to put the WHERE clause. This is why you check the logs first before asking for help elsewhere. Many problems could be solved if only one would read error messages and know where to look for them.
Re: mysql_tquery doesnt work -
Aa12 - 22.01.2016
Quote:
Originally Posted by Vince
In your MySQL log file you WILL find this snippet:
Код:
check the manual that corresponds to your MySQL server version for the right syntax to use near '`Name`'
Because you have forgotten to put the WHERE clause. This is why you check the logs first before asking for help elsewhere. Many problems could be solved if only one would read error messages and know where to look for them.
|
k thx dude
Re: mysql_tquery doesnt work -
Jack_SMalls - 23.01.2016
Quote:
Originally Posted by Aa12
mysql slowly kills me, lol
|
Once you have it down, it is a wonderful (and fast) tool to have that is useful for way more than just SA-MP.