9951 explained code solutions for 126 technologies


php-pdoGet affected rows with PHP PDO


$st = $pdo->prepare('UPDATE test SET updated_at = NOW()');
$st->execute();
$updated = $st->rowCount();ctrl + c
$pdo->prepare

prepare given query to execute

UPDATE test

sample query affecting multiple rows

$st->execute(

run query on the server

rowCount

returns affected rows

$updated

will contain affected rows