[HELP] please help get date
#1

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
Reply
#2

You are missing the ID at the end.
Reply
#3

I just give for activity how I save it
Reply
#4

Your giving the LastActivity value on "`LastActivity` = %s", but you are not giving the ID in "WHERE `ID` = '%d'".
Reply
#5

I give lastctivity how I save it beacuse is that problem not some id
Reply
#6

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.
Reply
#7

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]);
Reply
#8

Check your MySQL database variable type. Make sure it's a VARCHAR and not a FLOAT or whatsoever.
Reply
#9

yes it's varchar
Reply
#10

please, anyone?thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)