If you can, use prepared statements with mysqli or the PDO extension.
If not, use [man]mysql_real_escape_string/man,keeping magic_quotes_gpc set to Off.
If I have an input O'Connor and input it into my db as addslashed($_POST['myfield']) I still see only O'Connor in my db and not O\'Connor... I need to check my code -- this doesn't make any sense.
Why would "O\'Connor" be stored instead of "O'Connor"? After all, hasnt the single quote been escaped?
Note also that doubling the single quote is the standard way to escape it in SQL, but here MySQL differs from standard SQL (though allows for that option).