You need to "escape" those apostrophes.

Try adding an addslashes() around the variable containing your data with apostrophes.