I am trying to escape a string before inserting it to my DB, this string contains some characters that need to be escaped. For example :
$mystring = "So, This is the string it's causing me headaches."
I want to insert this string into a field which has certain limit, say 50.
But the problem is when I use the mysql_real_escape_string function it adds the \
to escape my single quote '
which makes my strings length 51 and therefore I could not insert it into the DB .