Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/10/2011, 08:28
gamau6
 
Fecha de Ingreso: octubre-2010
Mensajes: 156
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Problema con clases

bien cambiando un poco y leyendo por internet mas llegue a esto

Código PHP:
Ver original
  1. class Consulta{
  2.         # AQUI EJECUTAMOS LA CONSULTA
  3.         private $variable = array();   
  4.        
  5.         public function whil($sql1){
  6.             $sql = $sql1;
  7.             $res = mysql_query($sql, Conectar::con());
  8.             while($reg = mysql_fetch_assoc($res)){         
  9.                 $this->variable[] = $reg;              
  10.                 }              
  11.             return $this->variable;
  12.             }
  13.        
  14.        
  15.         }

lo llamo asi

Código PHP:
Ver original
  1. class pepito {
  2.                
  3.                
  4.                 private $armar;
  5. public function __construct(){
  6.                        
  7.                         $this->armar = new Consulta();                     
  8.                        
  9.                         }
  10.                 public function llamarcat(){
  11.                    
  12.                    
  13.                     //$sql = "SELECT * from tabla";            
  14.                     $this->armar->whil("SELECT * TABLA");
  15.                     /*while($reg = mysql_fetch_assoc($res)){
  16.                        
  17.                         $this->categorias[] = $reg;
  18.                        
  19.                         }
  20.                     return $this->categorias; */
  21.                     }
  22. }
ahora lo chistoso es que no me muestra nada... alguna ayudita??
__________________
..