我要选择城市,选择位置而不是选择库存,因为在提交操作“ search-inventory.php”后第一次结果显示很好,但是页面重新加载后出现了一些错误共享的想法。
此处的php代码
<?php
if (isset($_POST['search'])) {
$city_id = $_POST['city_id'];
$local_id = $_POST['local_id'];
$inventory_id = $_POST['inventory_id'];
$query=$conn->query("SELECT * FROM inventory WHERE city_id='$city_id' and local_id='$local_id' and local_id='$local_id'" );
} while($row=$query->fetch_array()){ ?>
<h1>some code and result</h1>
<?php }?
错误消息
注意:未定义的变量:在第49行的C:\ xampp \ htdocs \ listing \ search-inventory.php中进行查询
致命错误:在第49行的C:\ xampp \ htdocs \ listing \ search-inventory.php中调用null成员函数fetch_array()