drumhrd Posted February 4, 2010 Share Posted February 4, 2010 Ok..apparently I have no brain on today. Example code: $var = " INSERT INTO tour_dates(band_number,tddate1,tddate2,tddate3,tdvenue1,tdvenue2,tdvenue3, tdlocation1,tdlocation2,tdlocation3,tdtime1,tdtime2,tdtime3,tdcost1,tdcost2,tdcost3) VALUES('85','2010-07-17','2010-03-01','2010-07-12','Erin's bday','stepehn's bday','my Bday', 'some place cool','some place not so cool','a freaking sweet place to be','1:00 am','8:00 am', '4:00 am','02.00','01.00','05.00')"; I need to be able to comment out any single qoutes so I can make it work. I know there is a function somewhere..just got some serious brain block today..can't find the function I need. Thought maybe regex???? Dunno.. Basically 'Erin's bday','stepehn's bday', needs to look like 'Erin\'s bday','stepehn\'s bday', Link to comment https://forums.phpfreaks.com/topic/190880-help-reformatting-string/ Share on other sites More sharing options...
$Three3 Posted February 4, 2010 Share Posted February 4, 2010 Ok..apparently I have no brain on today. Example code: $var = " INSERT INTO tour_dates(band_number,tddate1,tddate2,tddate3,tdvenue1,tdvenue2,tdvenue3, tdlocation1,tdlocation2,tdlocation3,tdtime1,tdtime2,tdtime3,tdcost1,tdcost2,tdcost3) VALUES('85','2010-07-17','2010-03-01','2010-07-12','Erin's bday','stepehn's bday','my Bday', 'some place cool','some place not so cool','a freaking sweet place to be','1:00 am','8:00 am', '4:00 am','02.00','01.00','05.00')"; I need to be able to comment out any single qoutes so I can make it work. I know there is a function somewhere..just got some serious brain block today..can't find the function I need. Thought maybe regex???? Dunno.. Basically 'Erin's bday','stepehn's bday', needs to look like 'Erin\'s bday','stepehn\'s bday', Just add the addslashes function to it. http://php.net/manual/en/function.addslashes.php Link to comment https://forums.phpfreaks.com/topic/190880-help-reformatting-string/#findComment-1006593 Share on other sites More sharing options...
drumhrd Posted February 4, 2010 Author Share Posted February 4, 2010 thanks addslashes() did the trick...like I said..I am not thinking straight today..thanks again!! Link to comment https://forums.phpfreaks.com/topic/190880-help-reformatting-string/#findComment-1006605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.