mySQL Issue
#1

stock IsPlayerRegistered(playername[])
{
new szQuery[512];

format(szQuery, sizeof(szQuery), "SELECT * FROM `phpbb_users` WHERE `username` = '%s'", playername);
SendQuery(szQuery);

mysql_store_result();

if (mysql_num_rows() == 0)
return false;

return true;
}







That code look alright?
I'm logging in with my username and it's saying unregistered. :/
Reply
#2

First of all; Don't select everything when you're not even looking for something specific. "SELECT `username`" is better.

Secondly, you aren't freeing the result - this will cause great problems after a couple of queries. Make sure to mysql_free_result(); after you have used all the information in every mysql_store_result();

And lastly, run mysql_debug(1); and look at the MySQL log and you shall find your answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)