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



TimeStamp - norton2 - 30.08.2015

Not updating the CURRENT_TIMESTAMP. (Use ORM)

Код HTML:
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `safes` SET `SafeLastLog`=CURRENT_TIMESTAMP WHERE `ID`= '%d'", Safes[FactiuniSeif][ID]);
mysql_tquery(MySQLCon, query, "", "");



Re: TimeStamp - Roberto80 - 30.08.2015

Mmm idk about mysql,but try to use getdate function,guide:https://sampwiki.blast.hk/wiki/Getdate


Re: TimeStamp - norton2 - 30.08.2015

Also not updating "SafeLastLog" in DataBase MYSQL.



Код HTML:
new Year, Month, Day;
                    getdate(Year, Month, Day);
                    printf("%02d/%02d/%d", Day, Month, Year);
                     
                    new Days = getdate();
                    Safes[FactiuniSeif][SafeLastLog] = Days;
orm_update(Safes[FactiuniSeif][ORM_ID]);



Re: TimeStamp - Sjn - 30.08.2015

Use NOW() in your query format where you put the date. It gets the current date.

Код:
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `safes` SET `SafeLastLog`=NOW() WHERE `ID`= '%d'", Safes[FactiuniSeif][ID]);



Re: TimeStamp - Roberto80 - 30.08.2015

That sure it wont save/update!!!!
Use this:
Код:
new Year, Month, Day;
Safes[FactiuniSeif][SafeLastLog] = getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);
orm_update(Safes[FactiuniSeif][ORM_ID]);



Re: TimeStamp - norton2 - 30.08.2015

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Use NOW() in your query format where you put the date. It gets the current date.

Код:
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `safes` SET `SafeLastLog`=NOW() WHERE `ID`= '%d'", Safes[FactiuniSeif][ID]);
Not Work!

Код HTML:
 mysql_format(MySQLCon, query, sizeof(query), "UPDATE `safes` SET `SafeLastLog`=NOW() WHERE `ID`= '%d'", Safes[FactiuniSeif][ID]);
mysql_tquery(MySQLCon, query, "", "");



Re: TimeStamp - Vince - 30.08.2015

Have you tried running the query manually? If that works then the problem is obviously something in your code. By the way, favor UTC_TIMESTAMP() over NOW().


Re: TimeStamp - norton2 - 30.08.2015

Solved, thanks all, thank you Vince.!