I have this php
code sample and I have several rows in the database tables... but the condition (mysqli_num_rows($query) > 0
) is not satisfying...
<?php
include './Dashboard/database_connect.php';
if (!empty($_POST['firstName']) && !empty($_POST['lastName'])) {
$fname = $_POST['firstName'];
$lname = $_POST['lastName'];
$query = mysqli_query($conn, "SELECT * FROM patient WHERE firstname='$fname' AND lastname='$lname'");
$row= mysqli_num_rows($query);
echo "<script>alert('1')</script>";
if($row>0){ #this if condition is not becoming true, even if I have multiple rows in my database's patient table
echo "<script>alert('Rows Found')</script>";
}else{
echo "<script>alert('No Rows found')</script>";
}
} else {
echo "<script>alert('wrong')</script>";
}
?>
Can anyone please Help???