Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/06/2010, 12:36
Avatar de syntex
syntex
 
Fecha de Ingreso: noviembre-2002
Ubicación: Cataluña
Mensajes: 978
Antigüedad: 21 años, 5 meses
Puntos: 4
Problemas con clases de errores

Hola a todos,

He hecho una clase para las consultas de la bd mysql y tengo un sistema de errores, pero tengo un __LINE__ dentro de la clase y me gustaria hacer para saber la linea en donde se produce fuera de la clase.

Pongo ejemplo.

Código PHP:
          $R $Bd->consultar("*","config_web","","");
        while (
$RR $Bd->obtendatos($R)){ 
        ....................
        ....................
        ....................
        }
    
$Bd->limpiaconsulta($R); 
Así me indica la linea de la clase pero no donde se produce el error.

Muchas gracias

Código PHP:
class conectarMySQL {
function 
consultar($asterisco,$query,$where,$orderby) {
        if (
$this->tipo == "mysql"){
            if (!(
$this->consulta=mysql_query("SELECT $asterisco FROM $query $where $orderby",$this->enlace))){
                
$this->SELECT "$valor = SELECT $asterisco FROM $query $where $orderby";
                
conectarMySQL::errores();
            }
            return 
$this->consulta;
        }
    }
}
function 
limpiaconsulta($valor) {
        if ( 
$this->tipo == "mysql"){
            if (!
mysql_free_result($valor)){
                
$this->FREE_RESULT "Error en mysql_free_result";
                
conectarMySQL::errores();
            }
        }
    }
function 
errores() {
        
$this->ERR  "Url: "."http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."<br>";
        
$this->ERR .= "Pagina actual: ".$_SERVER['SCRIPT_FILENAME']."<br>";
        
$this->ERR .= "Servidor: ".$_SERVER['SERVER_NAME']."<br>";
        
$this->ERR .= "Protocolo: ".$_SERVER['SERVER_SOFTWARE']."<br>";
        
$this->ERR .= "Pagina actual: ".$_SERVER['HTTP_REFERER']."<br>";
        
$this->ERR .= "Ip: ".$_SERVER['REMOTE_ADDR']."<br>";
        
$this->ERR .= "Fichero Class: ".__FILE__."<br>";
        
$this->ERR .= "Line: ".__LINE__."<br>";    
        
$this->ERR .= '<br>';
        
$this->ERR .= "Fecha: ".date("Y-m-d")."<br>";    
        
$this->ERR .= "Hora: ".date("H:i:s")."<br>";    
        
$this->ERR .= '<br>';
        if (
$this->SELECT !=""){$this->ERR .= "SELECT: ".$this->SELECT."<br>";}
        elseif (
$this->NUMROWS !=""){$this->ERR .= "NUM_ROWS: ".$this->NUMROWS."<br>";}
        elseif (
$this->FREE_RESULT !=""){$this->ERR .= "FREE_RESULT: ".$this->FREE_RESULT."<br>";}
        elseif (
$this->MYSQL_CLOSE !=""){$this->ERR .= "MYSQL_CLOSE: ".$this->MYSQL_CLOSE."<br>";}
        
$this->ERR .= '<br>';
        
$this->ERR .= "Error ".mysql_errno($this->enlace)." : ".mysql_error($this->enlace);
            echo 
$this->ERR;
            exit;
    } 
__________________
------------------------------------------------
La paciencia es el rey de la ciencia
------------------------------------------------