3 回答

TA貢獻1829條經(jīng)驗 獲得超6個贊
試試這個 模型
public function vehicleFreight($branch_id)
{
$this->db->select('count(*)');
$this->db->from('truck_freight');
$this->db->where('truck_freight_status','truck_freight');
$this->db->where('fr_memo_to',$branch_id);
$query = $this->db->get();
return $query->result();
}

TA貢獻1827條經(jīng)驗 獲得超4個贊
獲得計數(shù)的多種方法
1 . echo count($query->result());
2 . echo $query->num_rows();
3 . You can use `count(*)` in `select` statement

TA貢獻1810條經(jīng)驗 獲得超4個贊
要獲取獲取的記錄數(shù),
$data = $query->result();
echo count($data); // use this as per your requirements
return $data;
- 3 回答
- 0 關(guān)注
- 172 瀏覽
添加回答
舉報