[HELP] MySQL R7 and Login...
#1

Problem already solved!
Reply
#2

If you use the cache then you can only use the cache_* functions. You already retrieved the amount of rows through cache_get_data, so there is no need for mysql_num_rows either.
Reply
#3

Try this:

pawn Code:
public CheckAccount(playerid, account[])
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        SetPVarInt(playerid, "IsRegistered", 1); // Then we set PVar for players that are registered already
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD...);
    }
    return 1;
}
As Vince said, no need to use mysql_num_rows() in R7.
Reply
#4

Quote:
Originally Posted by Calabresi
View Post
Try this:

pawn Code:
public CheckAccount(playerid, account[])
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        SetPVarInt(playerid, "IsRegistered", 1); // Then we set PVar for players that are registered already
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD...);
    }
    return 1;
}
As Vince said, no need to use mysql_num_rows() in R7.
Thank you really much Vince and Calabresi. I Didn't know that you can just use "rows", but thank you for that information! Now the login dialog seems to work correctly.

Then this, what I'm wondering: When using "mysql_real_escape", is it same as "%e", escaped string?
Reply
#5

Quote:
Originally Posted by CrossUSAAF
View Post
Thank you really much Vince and Calabresi. I Didn't know that you can just use "rows", but thank you for that information! Now the login dialog seems to work correctly.

Then this, what I'm wondering: When using "mysql_real_escape", is it same as "%e", escaped string?
It is indeed, but only if you use mysql_format(). Here is a small example:

pawn Code:
new query[64], pName[MAX_PLAYER_NAME], escname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
mysql_real_escape_string(pName, escname);
format(query, sizeof(query), "UPDATE Name='Testing' WHERE Name='%s'", escname);
mysql_function_query(cHandle, query, false, "OnQueryFinish", "i", playerid);
With mysql_format;

pawn Code:
new query[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
mysql_format(cHandle, query, "UPDATE Name='Testing' WHERE Name='%e'", pName); // '%e' automatically escapes the string.
mysql_function_query(cHandle, query, false, "OnQueryFinish", "i", playerid);
See, it makes things a little easier, at least for me.
Reply
#6

Thanks for your help guys! Problem solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)