Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
Codeigniter 使用'点燃数据表;如果';查询_Codeigniter_Datatable - Fatal编程技术网

Codeigniter 使用'点燃数据表;如果';查询

Codeigniter 使用'点燃数据表;如果';查询,codeigniter,datatable,Codeigniter,Datatable,如何在点燃的数据表上放置“if”查询?我的问题是: 这是我的控制器: function ajaxGetCard() { $this->load->library('Datatables'); $this->datatables->set_database('retail'); $this->datatables ->select('studEmpID, fullname, serialNumber, balance,

如何在点燃的数据表上放置“if”查询?我的问题是:

这是我的控制器:

function ajaxGetCard() {

    $this->load->library('Datatables');
    $this->datatables->set_database('retail');
    $this->datatables
         ->select('studEmpID, fullname, serialNumber, balance, If(status = "0", "Enable", "Disabled") as status')
         ->from('retail_card');

    echo $this->datatables->generate();
}
我的看法是:

<script type="text/javascript">
$(function() {
    $('#example').DataTable( {
        "bProcessing": true,
        "bserverSide": true,
        "ajax": "<?php echo site_url('card/ajaxGetCard'); ?>",
        "columns": [
            { "data": "studEmpID" },
            { "data": "fullname" },
            { "data": "serialNumber" },
            { "data": "balance" },
            { "data": "status" },
            { "data": "actions" }
          ]
    } );
});
</script>

<table class="table table-bordered datatable table-striped" id="example">
<thead>
    <tr>
        <th>ID Number</th>
        <th width="30%">Name</th>
        <th>Serial</th>
        <th>Balance (MYR)</th>
        <th>Status</th>
        <td>Actions</td>
    </tr>
</thead>    

我已经引用了给定的url,但仍然没有解决问题。如果我删除该查询中的“If”语句,一切正常。请帮助

你的标题中的点燃是什么意思?你是指codeIgniter吗?你的标题中的点燃是指codeIgniter吗?
DataTables warning: table id=example - Ajax error. For more information about this error, please see http://datatables.net/tn/7