Gossamer Forum
Home : Products : Gossamer Links : Discussions :

extended find and replace in DB to deal with underscores

Quote Reply
extended find and replace in DB to deal with underscores
Hello all!

This has to do with the underscores the program seems to put into catagory urls that contain spaces.

I found that if I changed the value of "Death/Death and Funeral Customs" in the "full name" field in the database, using mysqlman, to "Death/Death-and-Funeral-Customs" in my mysql database, when built it looks like this Death/Death-and-Funeral-Customs in my directory instead of this:
Death/Death_and_Funeral_Customs

I have over 100K entries in my database so doing this by hand to the rest of the entries is out of the question. Unsure

I am hoping some of you talented gurus can tell me how to do an extended find and replace so I can trade all blank spaces for a hyphen, in just the "full name" field.

Any ideas? Crazy

Thanks

Mike

BTW the project I am working on is at http://www.spiritandsky.com
Quote Reply
Re: [Palehorse777] extended find and replace in DB to deal with underscores In reply to
Make sure you back up your database first as this is off the top of my head.

UPDATE Category SET Full_Name = REPLACE(Full_Name," ","-")

Last edited by:

afinlr: Feb 1, 2004, 5:21 AM
Quote Reply
Re: [afinlr] extended find and replace in DB to deal with underscores In reply to
In Reply To:
Make sure you back up your database first as this is off the top of my head.

UPDATE Category SET Full_Name = REPLACE(Full_Name," ","-")


Heyya thanks! This looks like what I am looking for! Wink

Now for the romper room question:

Where do I put that command in? What script or program? I am too green to figure out where that commmand would go... Crazy I need some specfics, my specialty is html design not scripts and databases.

Thanks

Mike
Quote Reply
Re: [Palehorse777] extended find and replace in DB to deal with underscores In reply to
Go to Database->SQL Monitor and paste it into the box.
Quote Reply
Re: [afinlr] extended find and replace in DB to deal with underscores In reply to
In Reply To:
Go to Database->SQL Monitor and paste it into the box.

mysql> UPDATE Category SET Full_Name = REPLACE(Full_Name," ","-")
-> ;
ERROR 1146: Table 'directory.Category' doesn't exist

I am logged into the correct database after logging in to mysql. As you can see it returned an error..
Quote Reply
Re: [Palehorse777] extended find and replace in DB to deal with underscores In reply to
You'll need to put your table prefix in - probably lsql_Category
Quote Reply
Re: [afinlr] extended find and replace in DB to deal with underscores In reply to
In Reply To:
You'll need to put your table prefix in - probably lsql_Category


You are truly the man! SmileSmileSmile

This worked! Thanks!

Mike
Quote Reply
Re: [Palehorse777] extended find and replace in DB to deal with underscores In reply to
Glad it worked.
Laura.
(maybe I need to change my username to something more gender specific Tongue)
Quote Reply
Re: [afinlr] extended find and replace in DB to deal with underscores In reply to
In Reply To:
Glad it worked.
Laura.
(maybe I need to change my username to something more gender specific Tongue)


LOL Shocked

Sorry bout that... Unsure