我想用“ mysqli_num_rows”计数记录,但是在测试这段代码后我遇到了一些问题
$sql = "SELECT * FROM users WHERE users_name = 'abc'";
$query = mysqli_query($conn, $sql);
echo $row = mysqli_num_rows($query);
result => 1
但是在向SQL插入新条件“ OR”时
$sql = "SELECT * FROM users WHERE users_name = 'abc' OR users_phone = '12345678'";
$query = mysqli_query($conn, $sql);
echo $row = mysqli_num_rows($query);
result => empty value
我的表有2行
users_id = 1,
users_name = abc
users_phone = ''
and
users_id = 2,
users_name = efg
users_phone = 12345678
如果复制sql以在phpMyAdmin中测试正确,则满足2条记录