The difference between addslashes() and mysql_real_escape_string() is that
mysql_real_escape_string() escapes all characters harmful to a mysql
query (such as line feeds, carriage returns, quotes, and a number of other assorted special
characters), while addslashes() only escapes quotes (both single and double), backslashes, and the NULL byte.
here is a link with eg on this
Hope this will help you