I am learning OOP PHP with MySQL. I am trying to run a query that should print the number of rows returned. My php code is as follows:
$con= mysqli_connect('localhost','root','','dealinte_cms') or die(mysqli_error()); $email=" joy1@gmail.com "; if($r=$con->prepare("SELECT * FROM user WHERE email=? ")){ $r->bind_param("s",$email); if(!$r->execute()){ echo mysqli_errno($con); } else{ $rowCount=$r->num_rows; echo $rowCount; } }
In my database, this letter consists of 4 lines, so it should print 4, but it shows 0
What is wrong with my code?
source share