나는 codeigniter에서 같은 테이블의 전체 데이터와 전체 행 수를 가져 오는 2 가지 경우가 있습니다. 전체 행 수를 가져올 수있는 방법이 있는지 알고 싶습니다. , 전체 데이터를 하나 개의 코드를 통해 동일한 테이블 3 개 최신 삽입 레코드codeigniter의 데이터베이스에서 데이터 가져 오기
두 경우 모두에 대한컨트롤러 코드 (나는 다른 매개 변수를 별도로 각각의 경우에 대해이를 적용하고있다)에 대해서 설명 같다
public function dashboard()
{
$data['instant_req'] = $this->admin_model->getreq();
$this->load->view('admin/dashboard',$data);
}
1) 전자 가져 오기 CodeIgniter의에서 테이블에서 ntire 데이터
모델 코드
public function getreq()
{
$this->db->where('status','pending');
$query=$this->db->get('instanthire');
return $query->result();
}
보기 코드 CodeIgniter의에서 테이블에서 행의 수를 가져 오기 위해
foreach ($instant_req as $perreq)
{
echo $perreq->fullname;
echo "<br>";
}
2)
public function getreq()
{
$this->db->where('status','pending');
$query=$this->db->get('instanthire');
return $query->num_rows();
}
코드보기
echo $instant_req;
많은 기록들 –