Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

pdo get row count

// 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.
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #pdo #row #count
ADD COMMENT
Topic
Name
5+6 =