Jump to content

help with echo and insert in db


UnknownPlayer

Recommended Posts

Hi,

i insert in db with mysql_real_escape_string() function, but when i read i use this:

- htmlentities(stripslashes($value), ENT_QUOTES, "UTF-8") - for all fields but no textarea

- stripslashes($value) - for textarea, becouse when insert that textare, its tinymce, and have html tags

 

Is this right way ?

 

Link to comment
https://forums.phpfreaks.com/topic/250238-help-with-echo-and-insert-in-db/
Share on other sites

If data is retrieved from the database with slashes in it, either it wasn't properly escaped when it was inserted, or something is adding the slashes after retrieval. magic_quotes_gpc or magic_quotes_runtime may be on, or you have something applying addslashes() to your data. If you view the data in phpMyAdmin or the MySQL command line client, are the slashes there or not?

magic_quotes_gpc is on, so the data is being double escaped. You'll want to turn off magic_quotes_gpc in your php.ini file, and restart Apache. You may need to check with the host to see how to do that. Then you'll need to run an UPDATE query to get rid of the unnecessary slashes added to the data, or import it from a "clean" source.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.