Jump to content

Recommended Posts

Hi there !

I'm quite desperate as I can't find a quick method to partially change the content of a field.

I explain:
In a field named 'notes', PART of the content is:
[code]<a href='mailto:"[email protected]"'>[email protected]</a>[/code]
This content is wrong.

It must be:
[code]<a href="mailto:[email protected]">[email protected]</a>[/code]

How can I make the change with a SQL Query instead of manually make the change row by row (approximately 1500 rows contain the error!!!) considering the fact that [email protected] is different in each of the rows?

Many thanks in advance for any help!

Best regards,

Gerard
Link to comment
https://forums.phpfreaks.com/topic/27026-how-to-change-content-value/
Share on other sites

Not easily, really... REGEXP is useful for matching these rows, but you can't use Perl-style regexs to replace, AFAIK.  However, you can use a combination of LOCATE() and REPLACE(), since you can probably make some simplifying assumption about the location of these extra quotes.
I know this is a php board but maybe it would be simpler to export the data to a flat file and do a find and replace with any program of your choice.

then import the data back in.

With phpMyAdmin this would be pretty simple.

-Regards
John Sladek
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.