Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Global search and replace

Quote Reply
Global search and replace
I'd like to perform a global search and replace on MySQL database. I've checked with experts-exchange.com and the thread is below.

Any one at GT or forum that would warn me against doing this? My goal is to remove the words "Welcome to" from the titles of my links. Obviously, I'd back up EVERYTHING before hand. Thanks, April




I use MySQL from www.Gossamer-threads.com. It is basically a links directory.

I've got 5,000 links in the MySQL database.

The links can be "browsed" in alphabetical order.

So many of the links start with "Welcome to" in the Title.

I'd like to globally search and replace the entire database.

Is there a program that will do this?

Thanks, April


#################################################################

is it just one table?

if so...

update tblLinks set title = REPLACE(title, "Welcome to", "<replace with this string>")

#################################################################


yes, the database itsself is the program, that does things like that for you, as bobbit descibed.

the 4 basic sql-commands( this is the language to communicate with the database) are:

select, update, insert, delete.


select
-------
select -> gives you the data from 1 and more tables

select * from table1 where fieldc='test'
-> this way you all the records from table1 where fieldc='test'


update
---------
update -> lets you modify one ore more fields

update table1 set fielda='XXX' where fieldb='A'
-> this command sets in all records, which have in fieldb the entry 'A', the field fielda to 'XXX'

insert
---------
insert -> lets you insert a record(ore more) into a table

insert table1( fielda, fieldb ) values ( 'abc', 'def' )
-> this command inserts a record in table table1 with fielda='abc' and fieldb='def'

delete
---------
delete -> lets you delete a record(ore more) from a table

delete from table1 where fieldc='VV'
-> this command deletes all records in table1, which have in fieldc the entry 'VV'



hope to help :)

maik
A. Lougheed
IndyLinks.com
webmaster@indylinks.com
Quote Reply
Re: [aprillougheed] Global search and replace In reply to
Yeah, that statement should be fine. Obviously make sure you do a MySQL dump (backup) before playing with it (as you already said you would, I'm just making sure you were not doing a basic LSQL backup).

Hope that made sense Tongue

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Global search and replace In reply to
Hi Andy. Thanks for answering. You 'da best man. :)
A. Lougheed
IndyLinks.com
webmaster@indylinks.com
Quote Reply
Re: [aprillougheed] Global search and replace In reply to
>>>You 'da best man. :) <<<

LOL... just my sad humor, but thats an ironic title, considering I'm working on a Wedding site Tongue

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!