dongying3830 2014-05-15 06:19
浏览 121
已采纳

如何使用PHP更新当前日期的mysql?

I am trying to update a MySQL table with current date into a column which type is DATE. current date structure is (2014-05-15). I've tried a few ways but it is not updating the date, however it is updating other fields.

MySQL query.

$q = "UPDATE TABLE SET
    DESCRIPTION     =".$db->qstr($string).",
        DATE        =".$db->qstr(date('Y-m-d')).",
    LAST_ACT        =".$db->qstr( time())."
    WHERE  ID=".$db->qstr( $id); 

I've tried DATE = DATE(NOW()), and DATE = DATE(), but it is not updating in MySQL,

Any suggestions?

  • 写回答

3条回答 默认 最新

  • doumiang2297 2014-05-15 06:39
    关注

    Instead of DATE = DATE(NOW()). Try DATE = NOW()

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?