<?php $escapedstring = addslashes("He said, 'I'm a dog.'"); $query = "INSERT INTO test (quote) values ('$escapedstring')"; echo($query); ?>