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