如果在数据库ex-(type = 1,type = 2)相同的表中存在两种不同的类型,我该如何获取

时间:2016-10-13 10:51:03

标签: php mysql fetch

我有数据库表作为os_dish 在那道菜类型= 1是tiffen // dishtype = 2是午餐//

  

我的错误只是Tiffen和午餐中的tiffen价值

我想选择多个我怎么做才能这是我的Tiffen代码:

<div class="products-row">
    <?php $tq=$conn->query("select * from os_dish where dish_type=1");
        while ($tiffen = $tq->fetch_assoc()) {
        ?>  
        <div class="col-md-3"> 
            <div class="foodmenuform row text-center">
                <input type="checkbox" id="<?php echo $tiffen['dish_name'];?>" class="Foodmenu" value="<?php echo $tiffen['dish_name'];?>" name="tifeen[]" hidden>
                <label for="<?php echo $tiffen['dish_name'];?>"><img src="img/dish/<?php echo $tiffen['dish_image']; ?>" class="img img-responsive" /></label>
            </div>
        </div>
    <?php }  ?>
</div>

这是我的Luch代码:

<div class="products-row">
    <?php $lq=$conn->query("select * from os_dish where dish_type=2");
        while ($lunch = $lq->fetch_assoc()) {
        ?>  
        <div class="col-md-3"> 
            <div class="foodmenuform row text-center">
                <input type="checkbox"  id="<?php echo $lunch['dish_name'];?>" class="FoodMenu" value="<?php  echo $lunch['dish_name'];?>" name="lunch[]" hidden>
                <label for="<?php echo $lunch['dish_name'];?>"><img src="img/dish/<?php echo $lunch['dish_image']; ?>" class="img img-responsive" /></label>
            </div>
        </div>
    <?php }  ?>
</div>

0 个答案:

没有答案