Maybe I'm mistaken here, but the addslashes() method seems to be overkill for adding stuff to mySQL tables. If I put a single quote in a string and perform the addslashes function on it, it puts three forward slashes in front so what gets added to the database is \' (forward slash followed by escape):

$myString = addslashes( "Hello I don't want to use addslashes" );

becomes...

Hello I don\'t want to use addslashes

Is there a good reason for this?

Antun

    It is probably happening because you have magic_quotes_gpc set to "On" in your php.ini. This causes php to addslashes() once automatically and then you are adding them again.

    Hope this helps 😉

      Write a Reply...