12.01.2016, 21:40
If you have set the "LastActivity" column as "datetime" in MySQL:
You need to add the "02" and "04" values to the structure of the date and time.
MySQL expects this structure where all values are 2 characters or 4 characters long.
If you would have the 1st of January, your string would end up like "2016-1-1 0:0:9" for example, when the time is only 9 seconds past midnight, while MySQL expects "2016-01-01 00:00:09".
This won't apply if that column is set a varchar of course, only for datetime.
See if this does the trick.
PHP код:
// Get the current date, time
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
// Construct the complete date to be added to MySQL for the registration date+time
format(Date, sizeof(Date), "%04d-%02d-%02d %02d:%02d:%02d", Year, Month, Day, Hour, Minute, Second);
MySQL expects this structure where all values are 2 characters or 4 characters long.
If you would have the 1st of January, your string would end up like "2016-1-1 0:0:9" for example, when the time is only 9 seconds past midnight, while MySQL expects "2016-01-01 00:00:09".
This won't apply if that column is set a varchar of course, only for datetime.
See if this does the trick.