SA-MP Forums Archive
mysql doesnt save ip to the table - 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 doesnt save ip to the table (/showthread.php?tid=657824)



mysql doesnt save ip to the table - severance - 15.08.2018

I did something like this after player registration:

PHP Code:
    GetPlayerIp(playeridip50);
    
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `IP` = %d WHERE `id` = %d LIMIT 1",ippInfo[playerid][ID]);
    
mysql_tquery(g_SQLquery); 
It doesn't work.


Re: mysql doesnt save ip to the table - KinderClans - 15.08.2018

Change

pawn Code:
`IP` = %d
To

pawn Code:
`IP` = %s
Make sure IP row is varchar(24).


Re: mysql doesnt save ip to the table - severance - 15.08.2018

PHP Code:
`ipvarchar(24NOT NULL 
PHP Code:
    GetPlayerIp(playeridip16);
    
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `IP` = %s WHERE `id` = %d LIMIT 1",ippInfo[playerid][ID]);
    
mysql_tquery(g_SQLquery);
    
pInfo[playerid][IsLoggedIn] = true
Doesn't work.


Re: mysql doesnt save ip to the table - xMoBi - 15.08.2018

SA-MP uses IPv4 addresses, so you need maximum 16 characters as your IP variable buffer/ length.

Also, be sure to use ' with strings, for example: '%s'.


Re: mysql doesnt save ip to the table - KinderClans - 15.08.2018

Quote:
Originally Posted by xMoBi
View Post
SA-MP uses IPv4 addresses, so you need maximum 16 characters as your IP variable buffer/ length.

Also, be sure to use ' with strings, for example: '%s'.
Yes forgot this, sorry.


Re: mysql doesnt save ip to the table - severance - 15.08.2018

Thanks! works.