Hello I'm having a hard time trying to update this field automatically when I update something else in that same table called 'reps' the structure of the table is: id int primary key, name varchar(10) not null, date_up datetime
When I run this query:
SELECT * FROM reps;
it shows the information correctly however when I try to update a row of this table the date_up field is not updating... here's my code:
require dirname(__FILE__).'/db/connect.php';
$id = 5;
$name = "LCD Replacement";
$conexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$statement = $conexion->prepare('UPDATE reps SET name=:name, date_up = NOW() WHERE id = :id');
$statement->execute(array(
':name' => $name,
':id' => $id
));
when I refresh the page nothing is updated but if I run that same SQL query on the mysql console it work so I don't know what I'm doing wrong??