RE: [PHP] massive find/replace on MySQL db
| From: | John Holmes | Date: | Sat, 15 Jun 2002 16:32:15 +0000 |
| Subject: | RE: [PHP] massive find/replace on MySQL db | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102351@lists.php.net to get a copy of this message | ||
Yeah, do it all with regular queries. You shouldn't have to do any
replacing in PHP. You can even use the MySQL regular expressions in your
query for some more complex matching and replacing...
It's all in the manual...
---John Holmes...
> -----Original Message-----
> From: Julie Meloni [mailto:julie@thickbook.com]
> Sent: Saturday, June 15, 2002 11:12 AM
> To: Steve Clay
> Cc: PHP-GENERAL
> Subject: Re: [PHP] massive find/replace on MySQL db
>
> SC> I've inherited a MySQL db (4MB on disk) that's riddled with
> SC> inconsistent storage of character entities from being pasted from
> SC> Word. At very least I hope to convert all quotes "‘" -
"”"
> SC> to HTML's """ and "'".
>
> For each entity you wanted to replace, you could:
>
> update tablename set fieldwithcrap = replace(fieldwithcrap,
> 'oldstring', 'newstring');
>
> Keep an eye on all your escaping and what not. And do a dump before
> you do all your replacing, just in case something goes awry.
>
> If that doesn't work well, then I'd probably dump the data, run it
> through a string replacing script, and load it all back in. That
> wouldn't take too long either.
>
> - Julie
>
> --> Julie Meloni
> --> julie@thickbook.com
> --> www.thickbook.com
>
> Find "Sams Teach Yourself MySQL in 24 Hours" at
>
> http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php