addslashes(): escapes quotes, double quotes, backslashes, and NULLs with backslashes
<?php $escapedstring = addslashes("He said, 'I'm a dog.'"); $query = "INSERT INTO test (quote) values ('$escapedstring')"; echo($query); ?>
1. | To embed a single quote in a singly quoted string, escape it with a backslash | ||
2. | quotemeta(): escapes \ + * ? [ ^ ] ( $ ) | ||
3. | String SQL command escape |