Mysql
 sql >> Database >  >> RDS >> Mysql

Datetime NOW PHP mysql (+ variante PDO)

Poiché nessuno ha risposto esplicitamente alla domanda, aggiungerò la risposta corretta per completezza.

$stmt = $pdoDb->prepare('INSERT INTO tablename (id, value, time_created) VALUES (:id, :value, NOW())');
// either bind each parameter explicitly 
$stmt->bindParam(':id', $id); // PDOStatement::bindValue() is also possibly
$stmt->bindParam(':value', $value);
$stmt->execute();
// or bind when executing the statement
$stmt->execute(array(
    ':id'    => $id,
    ':value' => $value
));