Instructions: string addslashes ( string str ) Returns a string with backslashes added in front of certain characters for database query statements, etc. These characters are single quote (’), double quote (”), backslash () and NUL (NULL character). An example of using addslashes() is when you are entering data into a database. For example, inserting the name O’reilly into the database requires escaping it. Most databases use as escape character: O’reilly. This puts the data into the database without inserting extra . When the PHP directive magic_quotes_sybase is set to on, it means that inserting ' will be escaped with '. By default, the PHP instruction magic_quotes_gpc is on, which mainly automatically runs addslashes() on all GET, POST and COOKIE data. Do not use addslashes() on strings that have been escaped by magic_quotes_gpc, as this will result in double escaping. When encountering this situation, you can use the function get_magic_quotes_gpc() to detect it. |