当我关闭连接时,出现以下错误:
php警告:无法获取mysqli\u结果
这个错误是:
php警告:还不允许访问属性
我已经确保在循环外关闭连接,但是无论我在哪里放置断点,错误的行号都会改变。
我的php代码在这里:
$sql = "SELECT arrivalDate, departDate FROM holidayletdatabase.bookings
WHERE departDate > '$current_date'";
if ($result = $connect->query($sql)) {
while ($obj = $result->fetch_object()) {
array_push($bookings, $obj);
}
$result->close();
}
$connect->close(); //closes the connection
任何帮助都将不胜感激。谢谢:)
1条答案
按热度按时间vc6uscn91#
在if语句中使用$result之前,请先尝试定义它: