Page 1 of 1

How to insert texts that contain apostrophe?

Posted: Fri Nov 05, 2004 9:41 am
by ljCharlie
Here's what I'm trying to do. I'm trying to insert this:
INSERT INTO photoGallery (sectionID,fileName,path,category,description,comments,insertDate) VALUES (8,'Reunion282.jpg','images/gallery','current',''53 '54 '55 Basketball Reunion',NULL,'2004-11-05')
and the error is:
You have an error in your SQL syntax near '53 '54 '55 Basketball Reunion',NULL,'2004-11-05')' at line 1
So I'm guessing it has to do with the apostrophes that are in the '53 '54 '55. How do I solve this problem so that I can insert the apostrophes but get rid of this error?

ljCharlie

Posted: Fri Nov 05, 2004 10:10 am
by ljCharlie
Never mind, I got it working now.

ljCharlie

Posted: Fri Nov 05, 2004 10:34 am
by swdev
use the [php_man]mysql_escape_string[/php_man] PHP function to handle all the weird characters than can cause SQL to barf