我正在开发codeigniter php web应用程序。我有这样的错误:
致命错误:在第31行的C:\ wamp \ www \ ci_sock \ application \ models \ customer_m.php中调用未定义的方法CI_DB_mysql_driver :: group_start()
如何解决这个问题。我的d => (d.IsNullable && (d.ColumnType != typeof(string)) && (d.ColumnType.IsValueType)) ? type.MakeGenericType(new[]
{ d.ColumnType }) : d.ColumnType);
代码如下:
PHP
这样有31行foreach ($this->column_search as $item) // loop column
{
if($_POST['search']['value']) // if datatable send POST for search
{
if($i===0) // first loop
{
$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++;
}
。
请帮我解决这个问题。
答案 0 :(得分:3)
我有解决此问题的方法,请将您的代码更改为以下内容:
if($_POST['search']['value']) // if datatable send POST for search
{
if($i===0) // first loop
{
// $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
}
答案 1 :(得分:1)
试试这种方式。
$this->db->group_start();
$this->db->or_group_start();
foreach ($this->column_search as $item) // loop column
{
if($_POST['search']['value']) // if datatable send POST for search
{
$this->db->or_like($item, $_POST['search']['value']);
}
}
$this->db->or_group_end();
$this->db->group_end();
注意:此时我无法检查执行此代码