This question already has an answer here:
I had an issue. I do not want to insert ’
to the database.
Because when reading the ’
it will turn out with funny character.
Is there a way to prevent or encode ’
to '
when inserting to MySQL?
</div>
If you just want to replace that specific string why not just doing:
$encoded = str_repace("’","'",$input);