[eluser]alejandronanez[/eluser]
Hey!
I got a problem, I need to know how many rows does a query return in order to using that value in a FOR cycle on my view file.
I got this code in my model file.
Code:
function obtener_todos(){
$query = $this->db->get('Mytable');
if($query->num_rows>0){
foreach($query->result() as $fila){
$data[]=$fila;
}
return $data;
}
}
this in my Controller file:
Code:
function index(){
$data['main_content'] = 'area_en_nom_vista';
$data['filas'] = $this->area_en_nom_model->obtener_todos();
$data['title'] = 'Area ensenanza nombrado';
$this->load->view('area_en_nom_vista',$data);
}
How do I use the number of rows returned on the query on my view file?
I need help!!!
Thaks a lot!