php - Saving time() IN Mysql -


i using following code save time. have tried updating column type datetime , timestamp

$statement = $conn->prepare('update users set update = :update id = :clientid');                 $statement->bindparam(':clientid', $clientid, pdo::param_str);                 $statement->bindparam(':update', time(), pdo::param_str);                 $statement->execute();   {"error":"sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'update = '1367692928' id = 'i9pm90r-b4'' @ line 1"} 

update reserved keyword , happens name of column. in order avoid syntax error, column name should escaped using backticks. ex,

update users set `update` = :update id = :clientid 

if have privilege alter table, change column name not on reserved keyword list prevent same error getting again on future.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -