Hello
This problem is because ' is treated as end of input string in database so it creates problem so to insert ' you have to put a slash before ' like \' and this will work properly.
You can use an inbuilt function provided by PHP
string addslashes (string str)
$str="It's my string";
$newstr=addslashes ($str)
which will add slashes before all ' and take you out of trouble or other wise you can have an alternative solution by using string replace function you can replace all the ' with \'
mixed str_replace (mixed search, mixed replace, mixed subject)
$newstr = str_replace ("'", "\'", $str);
From Neetika