About tag for MySQL database

1

Good morning!

Galera! To with database more than 25 thousand records. I'm reshaping the database because it's very disorganized so I'm building a script to do everything automatic because doing 1 by 1 does not roll right.

Doubt is next, it has a text field, in this field there is tag's

But at the start of the process it is converting or removing tags.

It is writing as follows <b> to &lt;b&gt;

What I want is <b> to <b>

She can not convert or remove, what to do?

Follow the script.

while($r = mysqli_fetch_array($query)){

    $texto = htmlentities(str_replace('\'', '"', $r['artigo']), ENT_QUOTES);
    $qy = mysqli_query($con, "INSERT INTO posts SET titulo='{$titulo}', texto='{$texto}', chamada='{$r['chamada']}', view='{$r['visto']}', categoria='{$t}', img='{$r['id']}.jpg', data='{$r['dat']}', destaque='{$destaque}', link='{$link}'") or die(mysql_error());

}
    
asked by anonymous 12.04.2017 / 11:13

1 answer

1

I understand that you want to save your text $ variable with all HTML tags, so you have to write your text without the htmlentities function.

Do only replace $texto = str_replace('\'', '"', $r['artigo']);

    
13.04.2017 / 14:17