Can't update timestamp!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Can't update timestamp!

Post by Benjamin »

Why the *&%$ won't this query work?

Code: Select all

update customers set contract_start='20040805101215' where customer_id='50'
The query doesn't fail because there are other fields in it that DO get updated, but the timestamp continues to be all 0's
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

modify the field to be a datetime field.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Or perhaps:

Code: Select all

update customers set contract_start=unix_timestamp('20040805101215') where customer_id='50'
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

What is wrong with the original query?
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

It might be nothing with the query, it might be your data type in your SQL table. If you don't have it as a datetime field or if it isn't a int/char of 14 in length... you'll have problems.
Post Reply