Foros del Web » Programando para Internet » PHP »

eliminar tags html al recatar datos

Estas en el tema de eliminar tags html al recatar datos en el foro de PHP en Foros del Web. hola mi consulta es como hacer que no inserte tags de html en la base de datos o si lo insertas como ahcerlo para k ...
  #1 (permalink)  
Antiguo 24/01/2007, 13:46
 
Fecha de Ingreso: abril-2006
Mensajes: 240
Antigüedad: 18 años
Puntos: 1
eliminar tags html al recatar datos

hola
mi consulta es como hacer que no inserte tags de html en la base de datos o si lo insertas como ahcerlo para k nmo los imprimas onda <br>,<table>etc...

de antemanos muchas gracias

pd: uso php y mysql
  #2 (permalink)  
Antiguo 24/01/2007, 13:53
Avatar de mauled  
Fecha de Ingreso: marzo-2005
Ubicación: Cd. de México.
Mensajes: 3.001
Antigüedad: 19 años, 1 mes
Puntos: 33
De acuerdo Re: no insertar tags html en la bdd

Puedes intentar solucionar tu problema con strip_tags().

Saludillos.
  #3 (permalink)  
Antiguo 24/01/2007, 14:40
 
Fecha de Ingreso: abril-2006
Mensajes: 240
Antigüedad: 18 años
Puntos: 1
Re: no insertar tags html en la bdd

hola

sabes k lo coloco..pero no hace ...= m devuelve los tags en html

Código PHP:
function Table($query,$prop=array()){
    
//query
    
$res=mysql_query($query) or die('Error: '.mysql_error()."<BR>Query: $query");
    
//agrega una columna a la tabla si esta no es especificada
    
if(count($this->aCols)==0)
    {
        
$nb=mysql_num_fields($res);
        for(
$i=0;$i<$nb;$i++)
            
$this->AddCol();
    }
    
//Retrieve column names when not specified
    
foreach($this->aCols as $i=>$col)
    {
        if(
$col['c']=='')
        {
            if(
is_string($col['f']))
                
$this->aCols[$i]['c']=ucfirst($col['f']);
            else
                
$this->aCols[$i]['c']=ucfirst(mysql_field_name($res,$col['f']));
        }
    }
    
//Handle properties
    
if(!isset($prop['width']))
        
$prop['width']=0;
    if(
$prop['width']==0)
        
$prop['width']=$this->w-$this->lMargin-$this->rMargin;
    if(!isset(
$prop['align']))
        
$prop['align']='C';
    if(!isset(
$prop['padding']))
        
$prop['padding']=$this->cMargin;
    
$cMargin=$this->cMargin;
    
$this->cMargin=$prop['padding'];
    if(!isset(
$prop['HeaderColor']))
        
$prop['HeaderColor']=array();
    
$this->HeaderColor=$prop['HeaderColor'];
    if(!isset(
$prop['color1']))
        
$prop['color1']=array();
    if(!isset(
$prop['color2']))
        
$prop['color2']=array();
    
$this->RowColors=array($prop['color1'],$prop['color2']);
    
//Compute column widths
    
$this->CalcWidths($prop['width'],$prop['align']);
    
//Print header
    
$this->TableHeader();
    
//Print rows
    
$this->SetFont('Arial','',7);
    
$this->ColorIndex=0;
    
$this->ProcessingTable=true;
    while(
$row=mysql_fetch_array($res))
        
$this->Row($row);
    
$this->ProcessingTable=false;
    
$this->cMargin=$cMargin;
    
$this->aCols=array();
  }

en esa funcion la necesito.. para asi en otra pagina llamarla..y solo hacer el select..

de antemano gracias
  #4 (permalink)  
Antiguo 24/01/2007, 14:42
 
Fecha de Ingreso: abril-2006
Mensajes: 240
Antigüedad: 18 años
Puntos: 1
eliminar tags html al recatar datos

tengo esta funcion para solo hacer un select en otra clase pero kiero eliminar los tags html cuando este imprima
Código PHP:
function Table($query,$prop=array()){
    
//query
    
$res=mysql_query($query) or die('Error: '.mysql_error()."<BR>Query: $query");
    
//agrega una columna a la tabla si esta no es especificada
    
if(count($this->aCols)==0)
    {
        
$nb=mysql_num_fields($res);
        for(
$i=0;$i<$nb;$i++)
            
$this->AddCol();
    }
    
//Retrieve column names when not specified
    
foreach($this->aCols as $i=>$col)
    {
        if(
$col['c']=='')
        {
            if(
is_string($col['f']))
                
$this->aCols[$i]['c']=ucfirst($col['f']);
            else
                
$this->aCols[$i]['c']=ucfirst(mysql_field_name($res,$col['f']));
        }
    }
    
//Handle properties
    
if(!isset($prop['width']))
        
$prop['width']=0;
    if(
$prop['width']==0)
        
$prop['width']=$this->w-$this->lMargin-$this->rMargin;
    if(!isset(
$prop['align']))
        
$prop['align']='C';
    if(!isset(
$prop['padding']))
        
$prop['padding']=$this->cMargin;
    
$cMargin=$this->cMargin;
    
$this->cMargin=$prop['padding'];
    if(!isset(
$prop['HeaderColor']))
        
$prop['HeaderColor']=array();
    
$this->HeaderColor=$prop['HeaderColor'];
    if(!isset(
$prop['color1']))
        
$prop['color1']=array();
    if(!isset(
$prop['color2']))
        
$prop['color2']=array();
    
$this->RowColors=array($prop['color1'],$prop['color2']);
    
//Compute column widths
    
$this->CalcWidths($prop['width'],$prop['align']);
    
//Print header
    
$this->TableHeader();
    
//Print rows
    
$this->SetFont('Arial','',7);
    
$this->ColorIndex=0;
    
$this->ProcessingTable=true;
    while(
$row=mysql_fetch_array($res))
        
$this->Row($row);
    
$this->ProcessingTable=false;
    
$this->cMargin=$cMargin;
    
$this->aCols=array();
  }

uso la fnucion strip_tags()..pero no ahce nada
de antemano gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:10.