简体   繁体   中英

Set Date column to current time in mysql php

I am trying to set the date column to the current time stamp but for some reason I keep getting a syntax error.

$sql = "UPDATE testGraph
    SET date = CURRENT_TIMESTAMP
    SET State = ".$state1."
    WHERE Serial = ".$serial1."
   ";

Only one SET keyword is allowed in an UPDATE statement.

Replace the second SET keyword with a comma.

UPDATE mytable 
   SET mycol1  = expr1
     , mycol2  = expr2
--   ^
 WHERE ... 

在更新查询中只使用一个 SET 属性语法

UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM