MySQL Query - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Query (
/showthread.php?tid=172604)
MySQL Query -
Agent Smith - 30.08.2010
Hello people, I came up with this error today when I was working on my MySQL script. When a player does /login normally they are able to get all their information and so on but when I add it one more line which is:
pawn Код:
playerinfo[playerid][uid] = strval(field[13]);
It shows up as the command doesn't work.
pawn Код:
LoginPlayer(playerid, password[])
{
if(PlayerLogged[playerid])
return SendClientMessage(playerid, COLOR_GREY, "You are already logged in!");
CheckMySQL();
new string[526];
format(string, sizeof(string), "SELECT * FROM users WHERE name = '%s' AND password = '%s'", playerinfo[playerid][playername], password);
mysql_query(string);
mysql_store_result();
if(!mysql_num_rows())
return SendClientMessage(playerid, COLOR_GREY, "You have typed in the incorrect password");
new row[128];
new field[14][256];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mysql_free_result();
playerinfo[playerid][ID] = strval(field[1]);
format(playerinfo[playerid][Password], 32, "%s", field[2]);
playerinfo[playerid][Admin] = strval(field[3]);
playerinfo[playerid][Money] = strval(field[4]);
playerinfo[playerid][Bank] = strval(field[5]);
playerinfo[playerid][Faction] = strval(field[6]);
playerinfo[playerid][Rank] = strval(field[7]);
playerinfo[playerid][Skin] = strval(field[8]);
playerinfo[playerid][first] = strval(field[9]);
playerinfo[playerid][ban] = strval(field[10]);
format(playerinfo[playerid][banreason], 256, "%s", field[11]);
playerinfo[playerid][IP] = strval(field[12]);
playerinfo[playerid][uid] = strval(field[13]);
return 1;
}
Anyone see what I am doing wrong?
Re: MySQL Query -
armyoftwo - 30.08.2010
Try looking at MySQL logs, it has helped me tons of times.
Re: MySQL Query -
Agent Smith - 30.08.2010
There is nothing their in the log.. The only log result I got was 30 minutes ago when the script was working.
Re: MySQL Query -
armyoftwo - 30.08.2010
try printf("%s", string);
Re: MySQL Query -
Agent Smith - 30.08.2010
Код:
[21:04:44] SELECT * FROM users WHERE name = 'Alex_Zero' AND password = '*********'
Seems to be working, just doesn't seem to be able to go through the rest of the function. It keeps sayings Server: Unknown Command :/