Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 12:03 am EST
Geeklog Forums
Changing same text in 700 articles - SQL Query maybe?
Dave
Anonymous
Hello,
Lets say I have 700 articles on my website.
All of these 700 articles, somewhere in them, contain the phrase "orange car".
Now, lets say I want to change "orange car" to "green car".
Is there a quick way of doing this? An SQL Query perhaps?
Lets say I have 700 articles on my website.
All of these 700 articles, somewhere in them, contain the phrase "orange car".
Now, lets say I want to change "orange car" to "green car".
Is there a quick way of doing this? An SQL Query perhaps?
8
10
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
Download the database as CSV, do a 'search and replace' in a texteditor, and upload the whole bunch again.
I'm no developer, so I don't know about MySQL Queries.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
I'm no developer, so I don't know about MySQL Queries.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
6
7
Quote
Status: offline
Marites
Forum User
Chatty
Registered: 02/04/04
Posts: 64
I have done similar when changing url of the site (i.e. getting rid of the public_html) and changing the url's of image files.
What I did was backup the database from within GL take the resultant file and open in Textpad (Windows) or any other raw text editor - search and replace. Do them one at a time rather than replace all.
Put the saved file back on the server with a slightly different file name just in case .... restore the database and bingo it is all changed. If something is wrong you should still have the original backup (provided you changed the file name as mentioned).
Instructions for restoring are in the backup directory.
Marites
What I did was backup the database from within GL take the resultant file and open in Textpad (Windows) or any other raw text editor - search and replace. Do them one at a time rather than replace all.
Put the saved file back on the server with a slightly different file name just in case .... restore the database and bingo it is all changed. If something is wrong you should still have the original backup (provided you changed the file name as mentioned).
Instructions for restoring are in the backup directory.
Marites
9
9
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
There's no need for all of this because there really is a MySQL query for this.
It's good both for this simple request as well as for migrating the site entirely.
Well, I've told Dirk he should have added this to the FAQ...
It's good both for this simple request as well as for migrating the site entirely.
Well, I've told Dirk he should have added this to the FAQ...
8
8
Quote
Status: offline
Marites
Forum User
Chatty
Registered: 02/04/04
Posts: 64
I felt the problem quoting mysql queries could be a recipe for trouble by those who might make a mistake and mess the lot. My way whilst a bit more longwinded did allow the user to see what he was altering before committing the change.
Tess
Tess
Quote by LWC: There's no need for all of this because there really is a MySQL query for this.
It's good both for this simple request as well as for migrating the site entirely.
Well, I've told Dirk he should have added this to the FAQ...
It's good both for this simple request as well as for migrating the site entirely.
Well, I've told Dirk he should have added this to the FAQ...
7
9
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Well, in my way he could back up too. So the only difference between your way and mine is that your way allows him to approve each change individually.
But since he has 700 pages, I guess he'd end up using "search and replace all" and therefore, there's no real difference.
But in any case, both ways solve his problem.
But since he has 700 pages, I guess he'd end up using "search and replace all" and therefore, there's no real difference.
But in any case, both ways solve his problem.
7
11
Quote
All times are EST. The time is now 12:03 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content