get the number of affected rows in php using pdo update statement

Solutions on MaxInterview for get the number of affected rows in php using pdo update statement by the best coders in the world

showing results for - "get the number of affected rows in php using pdo update statement"
Mila
31 Apr 2017
1<?php
2  $update_stmt = $db->prepare("UPDATE user SET name=:name WHERE id=:id");
3$updatedCount = $update_stmt->execute(['name' => 'Bernard Arhia','id' => 2]);
4
5//$updateCount will return true if query was successful else it will return false