Storing connections. - 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: Storing connections. (
/showthread.php?tid=517424)
Storing connections. -
BleverCastard - 04.06.2014
I'm trying to store Name, IP and Date into a "connections" table in mysql however it doesn't seem to work. IP comes out as "49" and date is "0000-00-00".
pawn Код:
new ip[16], hour, minute, second;
GetPlayerIp(playerid, ip, sizeof(ip));
gettime(hour, minute, second);
format(query, sizeof(query), "INSERT INTO `connections` (`Name`, `IP`, `Date`) VALUES ('%s', '%s', '%d:%d:%d')", GetName(playerid), ip, hour, minute, second);
mysql_tquery(sqldb, query, "Query", "i", playerid);
IP: Set to varchar of 16. Date set to DATE in table.
P.S, Name works.
Re: Storing connections. -
Vince - 04.06.2014
Varchar16 should be correct. However, I recommend you use one of MySQL's many date functions. You can even set the default value for the column to the current timestamp.
Re: Storing connections. -
BleverCastard - 04.06.2014
Quote:
Originally Posted by Vince
Varchar16 should be correct. However, I recommend you use one of MySQL's many date functions. You can even set the default value for the column to the current timestamp.
|
Yeah, I've just changed the Date to:
Type | Collation Null Default
Date timestamp No CURRENT_TIMESTAMP
The IP seems to store, but the date doesn't.