php mysql , count rows
I have the following script :
$queryUniqueEmail = "SELECT email FROM Applicant WHERE email = '".base64_encode($email)."';"; $resultUniqueEmail = $db->query($queryUniqueEmail); $resultRowsEmails = $resultUniqueEmail->numRows(); if($resultRowsEmails == 0)开发者_开发百科 $db->query($query); } $resultRowsEmails->free(); } $db->close(); echo "Finish!";
Basically verifies a an email is existing already in the db and if so the insert operation is skipped . Howver I'm getting the following error when I run it
PHP Fatal error: Call to undefined method mysqli_result::numRows() in /var/www/html/asd.php
How can I fix it ?
There is no method called numRows
in the mysqli_result
class.
There is a property, num_rows
$resultRowsEmails = $resultUniquEmail->num_rows;
http://php.net/manual/en/class.mysqli-result.php
I think you're looking for num_rows
精彩评论