Problem with gstylez SQL? - 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: Problem with gstylez SQL? (
/showthread.php?tid=222678)
Problem with gstylez SQL? -
Antonio [G-RP] - 07.02.2011
This code used to work before I switched to G-sTyLezZz SQL plugin.
Any idea what's wrong?
pawn Код:
stock InitPlayerConnection(playerid)
{
ResetPlayerVariables(playerid);
new Query[128], Name[MAX_PLAYER_NAME], EscapedName[MAX_PLAYER_NAME], resultline[64];// field[3][3];
GetPlayerName(playerid, Name, sizeof(Name));
mysql_real_escape_string(Name, EscapedName);
format(Query, sizeof(Query), "SELECT `SQLid` FROM `accounts` WHERE `username` = '%s'", EscapedName);
mysql_query(Query);
mysql_store_result();
if( mysql_num_rows() >= 1 )
{
Re: Problem with gstylez SQL? -
nemesis- - 07.02.2011
The code looks logically correct. What isn't working?
Re: Problem with gstylez SQL? -
Antonio [G-RP] - 07.02.2011
Well, under the opening bracket at the end of the code above, is the login dialog, and load's players variables. The problem is that, there is an else statement with a "register" dialog (if no rows exist(?)) that comes up, instead of the login dialog.
Re: Problem with gstylez SQL? -
Rachael - 07.02.2011
I suggest you make your EscapedName variable a little larger to fit any possible number of escape characters.
Check your mysql_connect() for correct parameter order ( its slightly different to strickenkids )
turn on mysql debugging ( mysql_debug(1); )
This should help you to find the problem.
Re: Problem with gstylez SQL? -
Antonio [G-RP] - 07.02.2011
Wow, I feel like a complete idiot. The problem was the order of mysql_connect(), thanks, Rachael.