$this->db->select( 
             'df.id_proveedor, 
              df.id_estab, 
              df.no_factura, 
              df.generada, 
              df.vencimiento, 
              df.concepto, 
              df.descuento, 
              df.valor, 
              df.recibido, 
              df.fecha_elab, 
              dp.nom_dpto'); 
            $this->db->from('datos_factura df'); 
            $this->db->join('establecimientos es','df.id_estab = es.id'); 
            $this->db->join('ciudades ci','es.id_ciudad = ci.id_ciudad'); 
            $this->db->join('dptos dp','ci.id_dpto = dp.id_dpto'); 
            $query['sql']=$this->db->get();  
and sent him to the view in this way:
$this->load->view('facturas/FacturaView', $query);  
however, in the view I have a foreach loop, which is where I have to store the records that have the query, which put up, the foreach is this
foreach($sql as $row){ 
         .... 
         }  
sorry for the English, not speak English and use google translator
please help, it's greatly appreciate

 
                                 
            