Mysql login error Strickenkid's
#1

Hey!

Heres the code:



Код:
CheckAccountExists(account[])
{
	new string[128];
   	format(string, sizeof(string), "SELECT * FROM users WHERE username = '%s'", account);
   	mysql_query(string,1);
   	

	mysql_store_result(Handle);

	new value;
	value = mysql_num_rows(Handle);
	mysql_free_result(Handle);
	return value;
}
The console says that the query is executed but it gives me sum errors when i try to store the value..

Код:
[Sun Sep 16 15:07:34 2012] Error (0): Function: mysql_store_result called when no prior successful query executed.
[Sun Sep 16 15:07:34 2012] Error (0): Function: mysql_num_rows called when no result stored.
I have the connection..

Thank you!
Reply
#2

Does the table USERS exist? Does the variable USERNAME in table USERS exist?

pawn Код:
CheckAccountExists(account[])
{
    new string[128];
    format(string, sizeof(string), "SELECT * FROM `users` WHERE `username`= '%s'", account);
    new q = mysql_query(string);
    if(!q) return printf("Query did not work. %d",mysql_errno());
        mysql_store_result();

    new value;
    value = mysql_num_rows(Handle);
    mysql_free_result(Handle);
    return value;
}
Try this. Check console and tell me if any error popped up.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)