About tag for Mysql database

Asked

Viewed 608 times

1

Good morning!

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

The doubt is following, it has a text field, in this field there are tag’s

but at the time of starting the process it is converting or removing tags.

She’s recording it this way <b> for &lt;b&gt;

What I want is <b> for <b>

It cannot convert or remove, what to do?

Follows 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());

}

  • then you cannot use htmlentities. Example $text = "<b>text</b>" htmlentities($text) &lt;b&gt;texto&lt;/b&gt;

  • @Leocaracciolo but what way to do then? For if I take out htmlentities they are sent only text. I want to send with tags.

  • It’s really hard to explain, I’ll try to explain again. Example: pulling information from the bank and throwing the tags right into the bank. If I use htmlentities they are converted. I understand now?

1 answer

1


From what I understand you want to record, in the bank, its variable $text with all HTML tags, therefore, have to have your $text written without the htmlentities function.

Just do the replace $texto = str_replace('\'', '"', $r['artigo']);

  • already able to solve, it was only take out htmlentities and I had to make a gambiarra convert words

  • 1

    Well then, that’s what I said from the first comment "so you can’t use htmlentities."

Browser other questions tagged

You are not signed in. Login or sign up in order to post.