<?php
/* Delete all rows from the FRUIT table */
$del = $dbh->prepare('DELETE FROM fruit');
$del->execute();
/* Return number of rows that were deleted */
print("Return number of rows that were deleted:
");
$count = $del->rowCount();
print("Deleted $count rows.
");
?>
// query example
echo $db->query("SELECT * FROM users")->rowCount(); // Will return the total member number.
// prepare example
$query = $db->prepare("SELECT * FROM users WHERE user_username=? && user_password=?");
$query->execute(array($username, md5($password)));
echo $query->rowCount(); // Will return the number of columns affected.
// if($query->rowCount() > 0) means there is an user found with given username and password.