开发者

php mysql , count rows

开发者 https://www.devze.com 2023-02-09 22:50 出处:网络
I have the following script : $queryUniqueEmail = \"SELECT email FROM Applicant WHERE email = \'\".base64_encode($email).\"\';\";

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

0

精彩评论

暂无评论...
验证码 换一张
取 消