PDA

View Full Version : Cannot update Datetime field in mysql database


Spec_tray
05-06-2008, 05:55 PM
hai there..

I have mysql databese DATETIME field.in which i trying to update with current time when user doing certain action from my asp page.problem is when i am trying to run the update query which is.


Mysql_update = "Update User_mast"&_
" Set Us_a='1',"&_
" D_stmp='"&date()&"' Where "&_
" User_id='"&Userid&"'"&_
" and Pass_word='"&Password'"



But its not updating the field it shows the default value 0000-00-00 00:00:00
hope Somebody show me right direction

Thanks in advance

Spec_tray

codekilla
05-08-2008, 01:58 PM
try using now() instead of date().

or

you have to format the date to the correct format. i use php and it would look something like...
$mysqldate = date( 'Y-m-d H:i:s', $updateTime);