Yep you need to use addslashes on all the form fields when a user is submitting a form that will insert/update data in the database.
When retrieving that information, you need to use stripslashes before displaying it.
It's because the query sees the apostrophe in the fieldname as the end of the string
e.g.
$name = "Clark's Post";
" SELECT * FROM db WHERE name='$name' "
When you send the query it parses the string so the database sees:
" SELECT * FROM db WHERE name='Clark's Post' "
Everything after the second apostrophe is invalid syntax hence the error.
When the query
If you use addslashes on the form when adding data, the user won't need to use a \ in a search form.