【问题标题】:Codeigniter order_by name not workingCodeigniter order_by 名称不起作用
【发布时间】:2017-03-24 10:51:50
【问题描述】:

所以我当时使用 AJAX 调用从数据库中提取 10 条记录。

下面是我的代码:

public function get_next_10($offset = 0)
{
    $this->db->limit(15, $offset);
    $query = $this->db->get("postovi");
    return $query->num_rows() > 0 ? $query->result_array() : NULL;
}

我试过把:

$this->db->order_by("name", "asc");

但它抛出了一个错误。

【问题讨论】:

标签: php codeigniter


【解决方案1】:

工作正常

public function get_next_10($offset = 0)
{
$this->db->limit(15, $offset);
$this->db->order_by('name', 'asc');
$query = $this->db->get("postovi");
return $query->num_rows() > 0 ? $query->result_array() : NULL;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-17
    • 2012-07-27
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 1970-01-01
    • 2015-04-30
    • 2015-01-03
    相关资源
    最近更新 更多