我有这个php
代码示例,我在数据库表中有几行......但条件(mysqli_num_rows($query) > 0
)不满意......
<?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>";
}
?>
任何人都可以帮忙吗???