SA-MP Forums Archive
MySQL saving IP problem - 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)
+--- Thread: MySQL saving IP problem (/showthread.php?tid=398837)



MySQL saving IP problem - andrew2695 - 11.12.2012

thx for the help


Re: MySQL saving IP problem - iggy1 - 11.12.2012

Add this to see more detailed info on the error.

pawn Код:
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
    print(error);
    return 1;
}
EDIT: Change this too, no need to escape single quotes.
pawn Код:
(\'%s\', \'%s\', \'%s\', \'%s\')
To
pawn Код:
('%s', '%s', '%s', '%s')
That's probably the error.


Re : MySQL saving IP problem - andrew2695 - 11.12.2012

Oh thanks, Now the error is



Re: MySQL saving IP problem - iggy1 - 11.12.2012

Looks like your array isn't big enough for the query.

pawn Код:
stock CheckAccount(playerid)
{
    new query[100];//not exact but definatly big enough
    format(query, sizeof(query), "SELECT ID, Password, Salt, Admin FROM `accounts` WHERE `Name` = '%s' LIMIT 1", Name(playerid));
    mysql_function_query(g_Handle, query, true, "OnAccountCheck", "d", playerid);
    return 1;
}



Re : MySQL saving IP problem - andrew2695 - 11.12.2012

Lol, thanks alot! I'm a beginner in MySQL I thought it was more than that. It's now saving the ip. but If I need to add more variables, I'll need to always make bigger arrays? Because I have about 50 variables to store.. I'll need a n array of 5000 lol.


Re: Re : MySQL saving IP problem - InfiniTy. - 11.12.2012

Quote:
Originally Posted by andrew2695
Посмотреть сообщение
Lol, thanks alot! I'm a beginner in MySQL I thought it was more than that. It's now saving the ip. but If I need to add more variables, I'll need to always make bigger arrays? Because I have about 50 variables to store.. I'll need a n array of 5000 lol.
Why would you select all variables when the player needs to login.. you load them after he puts the right password..