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(playerid, ip, 50);
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `IP` = %d WHERE `id` = %d LIMIT 1",ip, pInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
It doesn't work.
Re: mysql doesnt save ip to the table -
KinderClans - 15.08.2018
Change
To
Make sure IP row is varchar(24).
Re: mysql doesnt save ip to the table -
severance - 15.08.2018
PHP Code:
`ip` varchar(24) NOT NULL
PHP Code:
GetPlayerIp(playerid, ip, 16);
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `IP` = %s WHERE `id` = %d LIMIT 1",ip, pInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
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
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.