Php阵列过滤器错误

时间:2017-09-26 07:45:10

标签: php sql

这是我目前用于过滤器的代码

<!-- Star Rating -->
<div class="panel-body">
    <div class="filter-head">
        <span id="stars-title" class="filter-title">Stars</span>
    </div>
    <div class="filter-body1">
        <div class="wrapper">
            <input type="checkbox" id="st1" value="1" name="star[]">
            <label for="st1"></label>
            <input type="checkbox" id="st2" value="2" name="star[]">
            <label for="st2"></label>
            <input type="checkbox" id="st3" value="3" name="star[]">
            <label for="st3"></label>
            <input type="checkbox" id="st4" value="4" name="star[]">
            <label for="st4"></label>
            <input type="checkbox" id="st5" value="5" name="star[]">
            <label for="st5"></label>
        </div>
    </div>
    <!--Price-->
    <div class="filter-head">
        <span id="stars-title" class="filter-title">Price</span>
    </div>
    <div class="filter-body">
        <div class="range-slider">
            <input class="range-sliderprice" id="slider-range" type="range" value="0" min="0" max="500" onchange="rangevalue.value = value" onfocus="rangevalue.value = value" onclick="get()" name="pricerange" value="<?php echo "<script>document.writeln(price);</script>"; ?>">
            <div class="range-slider__value">
                <span>RM 0 - RM </span><output id="rangevalue" id="amount">0</output>
            </div>
        </div>
    </div>
</div>

这是我用来过滤结果的代码,但它显示

  

mysqli_fetch_assoc()期望参数1为mysqli_result

<?php
if (isset($_POST["filter_btn"])) {
    if (isset($_POST["star"])) {
        $star_rating = $_POST["star"];
        foreach ($star_rating as $rating) {

        }
    } else {
        $rating = "";
    }

    if (isset($_POST["facilities"])) {
        $facilities_cb = $_POST["facilities"];
        foreach ($facilities_cb as $fac) {

        }
    } else {
        $facilities_cb = "";
    }

    $pricerange = $_POST["pricerange"];
    $hname = $_POST['hname'];

    $query = "SELECT * FROM hotel,room_type,facilities_details, WHERE hotel.hotel_id = room_type.hotel_id AND hotel.hotel_rating = '$rating' ";
    $result = mysqli_query($conn, $query);
}
?>

我认为我在参数和数组名称

中有问题

以下错误的图像:

error

0 个答案:

没有答案