Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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

<?php
  $update_stmt = $db->prepare("UPDATE user SET name=:name WHERE id=:id");
$updatedCount = $update_stmt->execute(['name' => 'Bernard Arhia','id' => 2]);

//$updateCount will return true if query was successful else it will return false
 
PREVIOUS NEXT
Tagged: #number #affected #rows #php #pdo #update #statement
ADD COMMENT
Topic
Name
7+3 =