【问题标题】:Limit in ignited datatable点燃数据表的限制
【发布时间】:2014-11-13 16:32:27
【问题描述】:
$this->db->select('employee_name');
$this->db->from('employee');
$this->db->limit(1,0);
$query = $this->db->get();
return $query->result();

如何在数据表中编写此查询。我写了如下查询。

$this->datatable->select('employee_name')
->from('employee');
$this->datatable->limit(1,0);
return $this->datatables->generate();

但它显示限制错误。

【问题讨论】:

  • 方法 limit() 未在数据表库中定义。我仍在寻找此功能。

标签: mysql codeigniter datatable limit


【解决方案1】:

我认为您在一般查询中使用了 codeigniter 方法链接,请尝试其中任何一种

通过方法链

$this->datatables->select('employee_name')
                ->from('employee')
                ->limit(1);
return $this->datatables->generate();

另一种方式

$this->datatables->select('employee_name');
$this->datatables->from('employee');
$this->datatables->limit(1);
return $this->datatables->generate();

【讨论】:

  • 感谢您的宝贵回复。我尝试了两个代码。但是发现报错,“Call to undefined method Datatables::limit()”。
  • 找到任何解决方案了吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-23
  • 1970-01-01
  • 2014-09-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多