簡體   English   中英

如何計算返回的行數?

[英]How do I count the number of rows returned?

我正在將My_model (由jamierumbelow開發)用於我的小型應用程序。

我已經進行了基本的用戶搜索,並試圖對結果進行分頁,但是我不知道如何獲取結果返回的總行數。 這是我控制器中的代碼:

protected function get_users(){


$this->load->model('user_model');


$this->data["users"]  = $this->user_model;

if($this->input->post('country')){
    $this->data["users"] = $this->data["users"]->search('country', $this->input->post('country'));
}

if($this->input->post('city')){
    $this->data["users"] = $this->data["users"]->search('city', $this->input->post('city'));
}


if($this->input->post('forename')){
    $this->data["users"] = $this->data["users"]->search('forename', $this->input->post('forename'));
}


if($this->input->post('surname')){
    $this->data["users"] = $this->data["users"]->search('surname', $this->input->post('surname'));
}

$this->data["bla"]  = $this->data["users"]->get_all();

}

如何計算結果總數? 謝謝。

使用$this->data["users"]->count_all()進行行計數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM