Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/09/2011, 09:01
thehack
 
Fecha de Ingreso: abril-2010
Mensajes: 151
Antigüedad: 14 años
Puntos: 1
problemas al ejecutar consultas

Hoal tengo un problemas con mi funtion en la db no me ejecuta las consultas

function para ejecutar la consulta
Código PHP:
/** Para ejecutar consultas en la conexi�n abierta */    
    
function ejecutarConsulta($msql "") {
        if (
$msql == "") {    
            
$this->merror "No introdujo la sentencia SQL";    
            return 
false;    
        }
                
$msql strtolower$this->_removeAllQuotes($msql) );
                
                if ( 
preg_match"#(?:/\*|\*/)#i"$msql ) )
                {
                   die( 
"You are not allowed to use comments in your SQL query.\nAdd \ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them" );
                    return 
false;
                }
                if ( 
preg_match"#[^_a-zA-Z]union[^_a-zA-Z]#s"$msql ) )
                {
                    die( 
"UNION query joins are not allowed.\nAdd \ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them" );
                    return 
false;
                }
                                else if ( 
preg_match_all"#[^_a-zA-Z](select)[^_a-zA-Z]#s"$msql$matches ) )
                {
                    if ( 
count$matches ) > )
                    {
                        die( 
"SUB SELECT query joins are not allowed.\nAdd \ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them" );
                        return 
false;
                    }
                }
        
//ejecutamos la consulta        
        
$this->mid_consulta mysql_query($msql);        
        if (!
$this->mid_consulta) {        
            
$this->merror_numero mysql_errno();        
            
$this->merror mysql_error()." error";
            return 
false;        
        }                
        return 
$this->mid_consulta// Si todo salio bien regresa el id de la consulta    
    

consulta
Código PHP:
public function getTemas(){
$this->ejecutarConsulta("select * from w_temas where tid = '{$this->settings['tema_id']}' limit 1");
//
$data mysql_fetch_assoc($this->mid_consulta);
//
return $data;

error de la consulta
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in

espero puedan ayudarme en este problema