Replace ' with ''

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?

str_replace(','',$comment);

Can someone please help me.