MySQLi查询不执行

时间:2018-06-30 16:11:27

标签: php mysql sql mysqli

在执行此代码段时

$result = mysqli_query($db,"SELECT * FROM 'teklab_support' WHERE 'archive' = 0 and 'adate' < 'mdate'");
$row_cnt = $result->num_rows;
echo $row_cnt;

我没有任何输出或错误。

该查询绝对正确-已在PHPMyAdmin中测试。

感谢您的帮助

2 个答案:

答案 0 :(得分:0)

所以我们实际上找到了解决方法

$count = $db->sql_numrows($db->sql_query("SELECT * FROM 'teklab_support' WHERE 'archive' = '0' and adate < mdate")); echo $count;

答案 1 :(得分:-2)

设置似乎不太好

$sql = "SELECT * FROM 'teklab_support' WHERE 'archive' = 0 and 'adate' < 'mdate'";
$results = mysqli_query($db, $sql);
$row_count = mysqli_num_rows($results);
echo $row_count;