Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Datetime NOW PHP mysql (+ variante PDO)


Como ninguém respondeu explicitamente à pergunta, adicionarei a resposta correta para completar.
$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
));