Hi
Sorry about posting yet another addslashes question, but I'm stumped on this and can't find an answer.
I use this function when adding text to MySQL, but notice that slashes are added to the text in the db when get_magic_quotes_gpc is on. This means that I then have to stripslashes when displaying the text from the database.
Question: Is this correct, do I need to stripslashes when displaying with magic_quotes_gpc is on, or is there an error somewhere?
function add_slashes ( $text )
{
if ( !get_magic_quotes_gpc() )
{
$text = addslashes( $text );
}
return $text;
}
When I add text like this with magic_quotes_gpc :
"I can't wait"
All I get in the db is this: \
How can I overcome this problem?
In general - do I have to stripslashes when displaying text from the db, when slashes are added to the text?
Is it better to do a character replace ( ie replace " with quot; )instead of bothering with slashes at all, and if so how?
TIA
Chris