Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] How many rows does a query return?
#1

[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!


Messages In This Thread
[SOLVED] How many rows does a query return? - by El Forum - 01-14-2010, 06:22 PM
[SOLVED] How many rows does a query return? - by El Forum - 01-14-2010, 06:32 PM
[SOLVED] How many rows does a query return? - by El Forum - 01-14-2010, 06:40 PM
[SOLVED] How many rows does a query return? - by El Forum - 01-14-2010, 07:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB