Posts: 1,018
Threads: 320
Joined: Jul 2010
Hello how can I get date on onplayerdisconnect and then it save like that 2/4/2014 in mysql but instead of that I get something like 167.833333333333333333. I have something like this but I have problem since last night and from then I can't solve it. I was all day spend on get date in mysql acc to be written but nothing. I save date as varchar and I have variable PlayerInfo[playerid][LastActivity]. So here is what I have on public onplayerdisconnect
pawn Код:
new str[255],day,month,year;
getdate(day,month,year);
format(str,255,"%d/%d/%d",day,month,year);
strmid(PlayerInfo[playerid][LastActivity],str,0,strlen(str),255);
and here is saving
mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `LastActivity` = %s
Posts: 731
Threads: 29
Joined: Feb 2012
Reputation:
0
You are missing the ID at the end.
Posts: 1,018
Threads: 320
Joined: Jul 2010
I just give for activity how I save it
Posts: 731
Threads: 29
Joined: Feb 2012
Reputation:
0
Your giving the LastActivity value on "`LastActivity` = %s", but you are not giving the ID in "WHERE `ID` = '%d'".
Posts: 1,018
Threads: 320
Joined: Jul 2010
I give lastctivity how I save it beacuse is that problem not some id
Posts: 1,861
Threads: 103
Joined: Sep 2011
Reputation:
0
Can you post the whole MySQL query please? Also, make sure that in the MySQL database the variable type of LastActivity is VARCHAR, not FLOAT or DECIMAL or something.
Posts: 1,018
Threads: 320
Joined: Jul 2010
I was go somewhere in d/d/d format I was move // and know in mysql have 201443 it is year-month-day but how can I get it like d/d/d if I set in format // it will be 168.78333333
pawn Код:
format(str,512,"%d%d%d",dan,mjesec,godina);
PlayerInfo[playerid][ZadnjaAktivnost] = str; know like that is 201443
if I set
format(str,512,"%d/%d/%d",dan,mjesec,godina);
PlayerInfo[playerid][ZadnjaAktivnost] = str; it will be 168,7833333
and here is the query in onplayerdisconnect
mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `LastActivity` = %s, WHERE `ID` = '%d'",
PlayerInfo[playerid][LastActivity],PlayerInfo[playerid][ID]);
Posts: 1,861
Threads: 103
Joined: Sep 2011
Reputation:
0
Check your MySQL database variable type. Make sure it's a VARCHAR and not a FLOAT or whatsoever.
Posts: 1,018
Threads: 320
Joined: Jul 2010
Posts: 1,018
Threads: 320
Joined: Jul 2010