Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/07/2006, 12:39
under_ground
 
Fecha de Ingreso: abril-2005
Mensajes: 491
Antigüedad: 19 años, 1 mes
Puntos: 1
para explicarlo mejor tengo la siguiente clase con la siguiente función.

Código PHP:
class Profesor
{
function 
Write()
    {
        
$this->error ""// limpia variable error

        
if($this->Loaded()) //llamado a la función
        
{
            
$query "UPDATE profesor SET
                            fecha_modificacion=NOW()"
;

            foreach ( 
$this->fields as $key => $val )
            {
                if( 
$this->changes[$key] )
                    
$query .= ",$key='$val'";
            }

            
$query .= " WHERE id_profesor='".$this->fields['id_profesor']."'";
            
$resp mysql_query($query$this->dbh) ;
        }
        else
        {
            
$query "INSERT INTO profesor SET
                            fecha_creacion=NOW()"
;

            foreach ( 
$this->fields as $key => $val )
            {
                if( 
$this->changes[$key] )
                    
$query .= ",$key='$val'";
            }

            
$resp mysql_query($query$this->dbh) ;
            
$this->fields['id_profesor'] = mysql_insert_id($this->dbh);
                    
        }

        return 
true;
    }

y ahora deseo que se ejecute esa función ¿Cómo puedo llamar?

Código PHP:
    require_once 'Profesor.php'// carga clase profesor

    
$profesor = new Profesor($dbh);
    
$profesor_update = new Profesor($dbh);
    
    
$profesor->Write(); 
Se me ocurre algo como eso, es posible ??