php - Updating date by CURRENT_TIMESTAMP .. Why all Zeros? -
I am trying to update on the date of the update of any update, field type datetime < / Code> and I set the default value to
CURRENT_TIMESTAMP
. When the updated SQL is excuted the result is all zero!
0000-00-00 00:00:00
From the Insert $ sql = 'INTO product_shop_offers (ID, Utpad_aidi, Dukan_aidi value , Currency_ID, added, last_update) '. 'Values (?,?,?,?,?,?,?) Key duplicate update ID =?, Shop_id =?, Value =?, Currency_id =?, Added_b =?, Last_update =?'; $ This- & gt; Db- & gt; Query ($ sql, array ($ storeInfoArray [ 'recordId'], $ productId, $ storeInfoArray [ 'storeNameNo'], $ storeInfoArray [ 'price'], $ storeInfoArray [ 'currency'], $ addedBy, 'CURRENT_TIMESTAMP ()' , $ storeInfoArray [ 'recordId'], $ storeInfoArray [ 'storeNameNo'], $ storeInfoArray [ 'price'], $ storeInfoArray [ 'currency'], $ addedBy, 'CURRENT_TIMESTAMP ()'))
Note: I checked but I could not understand the problem. Someone can help please.
This is because you are binding in the string 'CURRENT_TIMESTAMP ()'
. I'm not sure you can do this and it's being converted to zero.
If you have a default set in the database, why bother doing it completely? Just the area of statement .. Oh and column update CURRENT_TIMESTAMP attribute on the If you need this, you may have to type it in the query directly. will need to add:
changes modify column table product_shop_offers last_update DATETIME update CURRENT_TIMESTAMP Null default not CURRENT_TIMESTAMP;
Comments
Post a Comment