TimeStamp
#1

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, "", "");
Reply
#2

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

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

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

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

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, "", "");
Reply
#7

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().
Reply
#8

Solved, thanks all, thank you Vince.!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)