Jump to content

[SOLVED] Changing ' to '


e1seix

Recommended Posts

Have a slight query...

 

If I am running a script that updates my database with pre populated info like a product description, I keep coming across an error.

 

One of the places I'm lifting info from is a paragraph of words defined as a variable eg. $desc

 

$desc = "Jack and Jill's heads were hurting from the fall";

 

Automatically my script, because it's in a loop, ceases the minute it comes across the apostrophe symbol.

 

What I need is a script that will detect the apostrophe symbol and know to change it to ' before including it in the database. ie.

 

$desc = "Jack and Jill's heads were hurting from the fall";

 

How would one go about doing this? It's not just some sort of simple regex because I have no control over the various paragraphs - they will differ - and some will even have more than one apostrophe...

 

You all know me - I'm useless at this kind of thing. lol  ;)

Link to comment
https://forums.phpfreaks.com/topic/113772-solved-changing-to-39/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.