在数据库codeigniter中搜索json数据

时间:2016-09-24 18:30:52

标签: mysql json codeigniter

我有一个将数据保存到json的数据库和一个名为delivery_status的列,如下所示

[{"vendor":"1002","status":"on_delivery","delivery_time":""}]

现在从它获取状态并显示它后,我需要在表单中搜索我的查询是这样的状态

  $delivery_status = json_encode($this->input->post("delivery_status"));                
 $page_data['sale']  = $this->db//->like('status', $status)
               ->query("select * from sale where sale_datetime BETWEEN " . "'" .$date1. "'" . " AND " . "'" . $date2 . "'")
                ->result_array();

我的观点

<div class="form-group">
            <label for="status" class="col-sm-2 control-label">status</label>
            <div class="col-sm-10">
                <select  class="form-control width-r" name="payment_status">
                    <option>
                        <?php
                        $statuss = $this->db->query("SELECT  delivery_status FROM sale")->result_array();
                        foreach ($statuss as $status) {
                            $statu = json_decode($status['delivery_status']);

                            foreach ($statu as $ro) {
                                ?>
                            <option>

                                <?php echo $ro->status; ?>
                            </option>

                        <?php }
                    } ?>


                </select>

            </div>
        </div>

但没有结果。

0 个答案:

没有答案