2017-09-24 31 views
0

我使用数据表从MySQL中获取数据。数据表显示的数据,但是当我从搜索框中搜索任何数据。它显示一条警告消息。 My image is here数据表搜索框不工作

这是我的型号代码。

$this->db->from($this->table); 
    $i=0;//for search box. 

    foreach ($this->column_search as $item)//take column_search item in the loop check request and provide result. 
    { 
     if($_POST['search']['value'])//search box take request value if it's POST request 
     { 
      if($i===0) // first loop. if when i is equal and identical 
      { 
       $this->db->group_start(); // open bracket. query Where with OR clause better with bracket. because maybe can combine with other WHERE with AND. 
       $this->db->like($item, $_POST['search']['value']); 
      } 
      else 
      { 
       $this->db->or_like($item, $_POST['search']['value']); 
      } 

      if(count($this->column_search) - 1 == $i) //last loop 
       $this->db->group_end(); //close bracket 
     } 
     $i++; 
    } 
    if(isset($_POST['order'])) // here order processing 
    { 
     $this->db->order_by($this->column_order[$_POST['order']['0']['column']], $_POST['order']['0']['dir']); 
    } 
    else if(isset($this->order)) 
    { 
     $order = $this->order; 
     $this->db->order_by(key($order), $order[key($order)]); 
    } 
+0

什么在你的控制台日志中的错误? – hassan

+0

无法加载资源:服务器响应状态为404(未找到)。这是显示在控制台错误 – Majeed

+0

以及?现在是自我解释 – hassan

回答

0

它可能会丢失列,检查结果数据