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
Share on other sites

I love you DarkWater. You always feed me a clue to get the answer and never let me away with just getting someone to do the hard work for me.

 

I suppose it's the only way I'll learn. lol. Thank you  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.