Reputation: 1
How to store the current time (as in time()
) into the mysql database as a timestamp?
I tried this query:
UPDATE users
SET last_login = '1360826987'
WHERE username = 'test'
AND password = 'test'
where 1360826987 is my current time via time()
Upvotes: 0
Views: 113
Reputation: 5692
Use the NOW function of mysql instead.
UPDATE users SET last_login = NOW() ...
Upvotes: 3
Reputation: 2540
timestamp fields stores value in 2013-02-14 13:10:41 this format. so use now() in your query
Upvotes: 0
Reputation: 5399
That should work. But make sure that the field accepts Integers.
Type INT
Upvotes: 0