SA-MP Forums Archive
mySQL Issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mySQL Issue (/showthread.php?tid=189441)



mySQL Issue - Moglizorz. - 11.11.2010

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. :/


Re: mySQL Issue - Lenny the Cup - 11.11.2010

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.