# Replace ' with ''

**URL:** <https://forum.kirupa.com/t/replace-with/298158>\
**Category:** Uncategorized\
**Created:** [October 14, 2009, 4:06pm UTC](https://forum.kirupa.com/t/replace-with/298158 "2009-10-14T16:06:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gooo](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@Gooo](https://forum.kirupa.com/u/Gooo)\
**Post date:** [October 14, 2009, 4:06pm UTC](https://forum.kirupa.com/t/replace-with/298158/1 "2009-10-14T16:06:19Z")

</div>

Hi

I’ve got a mySQL database and a php file.  
The php file allows the user to add a comment and that comment is then added to the database.

Now, everything is working - the comments and database, but when I type in a [COLOR=Red]’[/COLOR] in the comment field, I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

Is there a way I can replace the ’ with ‘’, because when I type in ‘’ it works and only ’ is added to the database.

Can I do something like this before I add it to the database?

```auto
str_replace(','',$comment);

```

Can someone please help me.
