format(string, sizeof(string), "SELECT * FROM `accounts` WHERE `Username` = '%s' AND `Password` = '%s'", playername, password);
That's querying the data, you need to collect the information from the rows that are stored.
Have a look @ this tutorial by AndreT: https://sampforum.blast.hk/showthread.php?tid=337810 |
mysql_function_query(dbHandle, "SELECT * FROM accounts WHERE `Username` = '%s' AND `Password` = '%s'", playername, password);
public OnPlayerConnect(playerid)
{
new query[126];
if(Checkban(playerid) == 0)
{
format(query, sizeof(query), "SELECT * FROM accounts WHERE pName = '%s'", GetName(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1)
{
SendClientMessage(playerid, -1, "That username is registered!");
ShowPlayerDialog(playerid, dialogThreadLogin, DIALOG_STYLE_INPUT, "Login", "Please login with the password you made", "Login", "Cancel");
}
else
{
SendClientMessage(playerid, -1, "That username is not registered. You may register it");
ShowPlayerDialog(playerid, dialogThreadRegister, DIALOG_STYLE_INPUT, "Register", "Please enter a password you will remember", "Register", "Cancel");
}
}
return 1;
}
new query[126]
format(query, sizeof(query), "SELECT * FROM accounts WHERE pName = '%s'", GetName(playerid));