SA-MP Forums Archive
Ip/mysql - 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: Ip/mysql (/showthread.php?tid=166182)



[solved]Ip/mysql - ihatetn931 - 07.08.2010

Ok, I have a issue with ips saving to a mysql database.

To get the player ip //This is at the top of my Saveaccount by all the other strings
pawn Код:
new playerip[16];
GetPlayerIp(playerid, playerip, sizeof(playerip));
My save account the part where it saves the ip, Public SaveAccount(playerid);
pawn Код:
format(string, sizeof(string), "UPDATE `players` SET `Carkey1` = '%d', `Carkey2` = '%d', `Carkey3` = '%d' , `Ip` = '%s' WHERE `id` = '%d'",PlayerInfo[playerid][pPcarkey], PlayerInfo[playerid][pPcarkey2],PlayerInfo[playerid][pPcarkey3],PlayerInfo[playerid][pID],playerip);
mysql_query(string);
When it goes to save to the data base it dosen't print the ip in the database it just shows a blank spot where the ip should be

Mysql Table Info
Код:
Field	Type	            Collation	    Null	Default	Extra
Ip	varchar(16)	latin1_swedish_ci    No      None
Top of my Saveaccount just incase it's needed
pawn Код:
forward SaveAccount(playerid);
public SaveAccount(playerid)
{
    new playerip[16];
    GetPlayerIp(playerid, playerip, sizeof(playerip));
    new string[255];
    if(PLogged[playerid] == 1)
    {
Does anyone have any idea why it's printing out a blank instead of the ip?


Re: Ip/mysql - Fj0rtizFredde - 07.08.2010

As I can see it playerip and PlayerInfo[playerid][pID] should change place in your format code


Re: Ip/mysql - ihatetn931 - 07.08.2010

I had a feeling it was gonna be something simple, Makes me wonder why i didn't notice that in the firsy place, I'm a moron lol