05.03.2011, 01:48
So I'm experimenting with MySQL and I am trying to replace my existing reg/login system with MySQL. I just started and tried making the check to see if the account exists, but keep having mysql_num_rows returning -1. Here is the check so far:
I manually inserted the row into the table so I know it exists. Like I said, on the print of mysql_num_rows I keep getting -1. Any help is appreciated. This is G-stylezzz plugin, R5 for windows by the way.
EDIT: I did some debugging of the query and name is ' ', so the problem appears to be there. escName is always blank.
pawn Код:
new Query[128], escName[24];
mysql_real_escape_string(Name, escName);
format(Query, sizeof(Query), "SELECT * FROM `pinfo` WHERE name = '%s'", escName);
mysql_query(Query);
mysql_store_result();
printf("%d", mysql_num_rows());
if(mysql_num_rows() == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Welcome to The Community!", "Please enter a password below to register with our server!", "Register", "Cancel");
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome Back!", "Please enter your password to login!", "Login", "Cancel");
}
mysql_free_result();
EDIT: I did some debugging of the query and name is ' ', so the problem appears to be there. escName is always blank.