警告:mysqli_fetch_array()期望参数1为mysqli_result,布尔值为

时间:2015-06-06 10:24:01

标签: php mysql

我正在尝试选择该表,但它会显示Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

我的代码:

<?php
require 'database/db.php';
$fetch = $mysqli->query("SELECT * FROM buyhistory WHERE email = xxx@hotmail.com ORDER BY user_id DESC ");
while($row = mysqli_fetch_array($fetch))
{
echo "<tr>";
echo "<td>" . $row['purchasedate'] . "</td>";
echo "<td>" . $row['buyitem'] . "</td>";
echo "<td>" . $row['enddate'] . "</td>";
echo "</tr>";
}
?>

如何解决?谢谢

1 个答案:

答案 0 :(得分:0)

应为email =&#39; xxx@hotmail.com'

$fetch = $mysqli->query("SELECT * FROM buyhistory WHERE email = 'xxx@hotmail.com' ORDER BY user_id DESC");