My string $name = "Ali'Shan"; I want store it into database but the ' I use htmlentities/ htmlspecialchars and str_replace but insert I still get syntax error ' .
$name = "Ali'Shan";
str_replace("'", "", $name);
echo $name;
echo htmlentities($name);
My output is still Ali'Shan
mysql_real_escape_string, it forces you to use themysql_library, which is deprecated and will be removed from PHP. There are better alternatives.