表中只有30个值,但mysqli_num_rows($result) return 60
同一查询执行两次,代码如下:
<?php
error_reporting(E_ALL);
$con=mysqli_connect('127.0.0.1','***','***','***');
if (mysqli_connect_errno()) {
# code...
echo "Could not connect to MYSQL database".mysqli_connect_error();
}
$sql = "select * from ticket_staff";
$result = mysqli_query($con, $sql);
echo mysqli_num_rows($result);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo $row["t_ID"]."<br>";
}
} else {
echo "0 results";
}
?>