Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在使用$this->;时禁用codeigniter中的反勾号;db->;选择();_Php_Mysql_Sql_Codeigniter_Datatables - Fatal编程技术网

Php 如何在使用$this->;时禁用codeigniter中的反勾号;db->;选择();

Php 如何在使用$this->;时禁用codeigniter中的反勾号;db->;选择();,php,mysql,sql,codeigniter,datatables,Php,Mysql,Sql,Codeigniter,Datatables,我有一个功能: function datatables () { $this->db->select(' (CASE WHEN L_Type_Name="Khusus" THEN CONCAT("<i id=",L_Type_ID," class=\"formUpdate\" title=\"Ubah\"></i> <i id=",L_Type_ID," class=\"formDelete

我有一个功能:

  function datatables ()
  {
    $this->db->select('
      (CASE 
        WHEN L_Type_Name="Khusus" 
        THEN CONCAT("<i id=",L_Type_ID," class=\"formUpdate\" title=\"Ubah\"></i> <i id=",L_Type_ID," class=\"formDelete\" title=\"Hapus\"></i>")
      END) Option');
    $this->db->from('leave_type');
    return $this->datatables->generate();
  }
在这里:

$this->db->from('',false);
但是,出现另一个错误,表明未使用表:

<h1>A Database Error Occurred</h1>
    <p>Error Number: 1096</p><p>No tables used</p><p>SELECT *</p><p>Filename: C:/XAMPP/htdocs/sicuti/system/database/DB_driver.php</p><p>Line Number: 691</p>
发生数据库错误 错误号:1096

未使用表

选择*

文件名:C:/XAMPP/htdocs/sicuti/system/database/DB_driver.php

行号:691

我删除了一个错误的参数 $this->db->select()和$this->db->from(),相同错误1096

我的代码怎么了? 以前我感谢你


我认为您在
from
select
中都使用了false,您只需要在
select()中使用
false

尝试使用以下方法:

$this->datatables->select('
        (CASE 
            WHEN leave_type.L_Type_Name="Khusus" 
            THEN CONCAT("<i id=",leave_type.L_Type_ID," class=\"formUpdate\" title=\"Ubah\"></i> <i id=",leave_type.L_Type_ID," class=\"formDelete\" title=\"Hapus\"></i>")
        END) Option', false);
$this->datatables->from('leave_type');
return $this->datatables->generate();
$this->datatables->select('
(案例
离开时,请键入。L\u type\u Name=“Khusus”
然后是CONCAT(“”)
结束)选项',错误);
$this->datatables->from('leave_type');
返回$this->datatables->generate();

感谢您的回答,我发现了我的错误,我应该使用datatable查询生成器($this->datatables)而不是CI:($this->db)

$this->datatables->select('
(案例
当L_Type_Name=“Khusus”
然后是CONCAT(“”)
结束)选项',错误);
$this->datatables->from('leave_type');
返回$this->datatables->generate();

谢谢,但我已经这样做了,但是仍然出现了这样的错误:
code
发生了一个数据库错误错误号:1096

没有使用表

选择*

文件名:C:/XAMPP/htdocs/sicuti/system/Database/DB\u driver.php

行号:691

code
用于自定义查询(…)
$this->db->from('',false);
<h1>A Database Error Occurred</h1>
    <p>Error Number: 1096</p><p>No tables used</p><p>SELECT *</p><p>Filename: C:/XAMPP/htdocs/sicuti/system/database/DB_driver.php</p><p>Line Number: 691</p>
$this->datatables->select('
        (CASE 
            WHEN leave_type.L_Type_Name="Khusus" 
            THEN CONCAT("<i id=",leave_type.L_Type_ID," class=\"formUpdate\" title=\"Ubah\"></i> <i id=",leave_type.L_Type_ID," class=\"formDelete\" title=\"Hapus\"></i>")
        END) Option', false);
$this->datatables->from('leave_type');
return $this->datatables->generate();
$this->datatables->select('
     (CASE
       WHEN L_Type_Name="Khusus"
       THEN CONCAT("<i id=",L_Type_ID," class=\"formUpdate\" title=\"Ubah\"></i> <i id=",L_Type_ID," class=\"formDelete\" title=\"Hapus\"></i>")
     END) Option', false);
$this->datatables->from('leave_type');
return $this->datatables->generate();