Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/10/2007, 10:17
Avatar de Seppo
Seppo
 
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Re: se puede llamar una funcion dentro de un constructor?

Fijate que no es una función, sino un método, así que le debés indicar el objeto ($this->...), igualmente el error está en la línea 31, eun una función get_galeria que no la posteaste... probá con esto, y sino copiá el código completo
Código PHP:
<?php
class Galeria{
    var 
$conexio;
    var 
$ruta;
    var 
$titol;
    var 
$id;

    function 
Galeria($id,$db){
        
$this->conexio=$db;
        
$this->id=$id;
        echo 
"id ".$id."\n";
        echo 
"Conexio ".$conexio."\n";
        
$galeria=$this->getGaleria($this->id);
        
$this->ruta=$galeria[1];
        
$this->titol=$galeria[0];
    }
    
    function 
getGaleria($id){
        
$query="SELECT * FROM galeria where id =".$this->id;
        
$recordSet = &$this->conexio->Execute($query);
        while (!
$recordSet->EOF){
            
$retorno[0]=$recordSet->fields[1];//titulo
            
$retorno[1]=$recordSet->fields[2];//ruta
            
$recordSet->MoveNext();
        }
        return 
$retorno;
    }
}
?>