Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/10/2013, 12:07
mathiasmontiel
 
Fecha de Ingreso: febrero-2013
Mensajes: 163
Antigüedad: 11 años, 3 meses
Puntos: 1
Respuesta: MVC traer registros en un array

Lo solucioné así:

modelo.php
Código PHP:
public function get() {
    
$this->query "
        SELECT producto, precio, id
        FROM productos
    "
;
    
$this->get_results_from_query();


controlador.php
Código PHP:
function handler() {

    
# (...)

    
if ($_GET['p'] == 'consulta') { 
        
$usuarios set_obj();
        
$usuarios->get();
        
$data = array($usuarios->rows);     
    
        
retornar_vista(VISTA_INICIO$data);
    } else {
        
# (...)
    
}

Y desde la vista puedo manipular los datos con foreach. Espero haberlo hecho bien.