9951 explained code solutions for 126 technologies


php-pdoUPDATE query example with PHP PDO


$st = $pdo->prepare('UPDATE test SET age = :new_age WHERE id = :id');
$st->execute([':new_age' => 53, ':id' => 1]);ctrl + c
$pdo->prepare

prepare given query to execute

$st->execute(

run query on the server

[':new_age' => 53, ':id' => 1]

bind both update values (used in SET) and filter values (used WHERE)