Gossamer Forum
Home : Products : Gossamer Links : Discussions :

nd and replace in mysql

Quote Reply
nd and replace in mysql
I'm hoping someone could tell me how to run a find and replace in mysql if it is possible??

I need to search my linkssql table for the title field to find and replace all " / " with a " - "

I have about 900 records so doing it by hand would take a looooong time.

I just want to change the titles from " links for you/ by us" to "links for you - by us"

is this possiable???
Quote Reply
Re: [carminejg3] nd and replace in mysql In reply to
Hi,

You could try: Database > MySQLMonitor ... and run;

UPDATE lsql_Links SET Title = REPLACE(Title,'/','-') WHERE Title LIKE '%/%'

Be sure to make a backup first, just in case it doesn't have the desired effect =)

Hope that helps.

Cheres

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] Find and replace in mysql In reply to
Great it worked.

I ran a backup first
Then
Checked to see how many links i was going to fix.

SELECT * FROM lsql_Links WHERE title like '%/%'

links: 899

Then ran
UPDATE lsql_Links SET Title = REPLACE(Title,'/','-') WHERE Title LIKE '%/%'

and reran the
SELECT * FROM lsql_Links WHERE title like '%/%'
Links: 0

To double check I also went into
Database > Links > Modify > partial link title and the '/' was replaced with '-'

Thanks,
Andy