When I an insert query contains a quote (e.g. Kellog's), it fails to insert a record.
ERROR MSG:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘s’,’Corn Flakes 170g’,’$ 15.90′,’$ 15.90′,’$ 14.10′,’–‘)’ at
line 1MySQL Update Error:
The first 's', should be Kellogg's.
Is there any solution?
Escape the quote with a backslash. Like
'Kellogg\'s'.Here is your function, using
mysql_real_escape_string: