Posts: 1,047
Threads: 23
Joined: Jun 2009
What's the problem?...
I have something like this:
pawn Код:
mysql_query(sprintf("SELECT * FROM `users` WHERE `nickname` = '%s'",Player[playerid][Nick]),CHECK_LOGIN,playerid);
callback:
pawn Код:
case CHECK_LOGIN:
{
mysql_store_result();
if(mysql_fetch_row_format(GlobalString2048))
{
Player[playerid][registered] = true;
sscanf(
GlobalString2048,
"p<|>ds[24]s[32]s[129]ddddddddds[24]s[24]s[24]dds[128]s[16]ds[129]ddd",
//variables
);
mysql_free_result();
}
And it works great..
Posts: 1,047
Threads: 23
Joined: Jun 2009
Quote:
Originally Posted by Abreezy
So weird, it's not working for me, this is what i have:
pawn Код:
if(response) { new query[400],escapepass[26]; mysql_real_escape_string(inputtext, escapepass); format(query, sizeof(query), "SELECT * FROM Accounts WHERE Username = '%s' AND Password = '%s' ", pName(playerid), escapepass); mysql_query(query); mysql_store_result(); if(mysql_num_rows() != 0) { if(mysql_fetch_row_format(query, "|")) { sscanf(query,"p<|>ddddfffddddd",PlayerInfo[playerid][Cash],PlayerInfo[playerid][Skin], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Posx], PlayerInfo[playerid][Posy], PlayerInfo[playerid][Posz],PlayerInfo[playerid][Age],PlayerInfo[playerid][Gender],PlayerInfo[playerid][Tutorial],PlayerInfo[playerid][Muted],PlayerInfo[playerid][Admin]); }
And it doesn't load, but when i dont use * and use actual field names, it works.
|
if(mysql_num_rows() != 0)
is not needed because mysql_fetch_row_format will fail when there are no rows, your problem is a bit weird but try doing only WHERE Username = '%s';
without password. just store the password and make sure u compare to it in pawn. It's not that much performance loss..