1

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."
   ";
Alan
  • 25
  • 1
  • 5

2 Answers2

1

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 ... 
spencer7593
  • 106,611
  • 15
  • 112
  • 140
0

In a update query only one SET attribute is used Syntax

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

Naresh Kumar
  • 561
  • 2
  • 15