Problem with gstylez SQL?
#1

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 )
    {
Reply
#2

The code looks logically correct. What isn't working?
Reply
#3

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.
Reply
#4

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.
Reply
#5

Wow, I feel like a complete idiot. The problem was the order of mysql_connect(), thanks, Rachael.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)