addslashes vs mysql_escape_string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

addslashes vs mysql_escape_string

Post by tores »

Hi

If I do addslashes() on a string before inserting it into my db, is it the same as doing mysql_escape_string() before insertion?
And if I have magic_quotes_gpc set in the php-config file, do I have to do addslashes/ mysql_escape_string() and stripslashes when interacting with the db?

Regards tores
Post Reply