Page 1 of 1

HELPED-Find and Replace in PHPmyAdmin - Changing _ Underscores to - dashes

Posted: Mon Apr 23, 2007 11:21 pm
by brainpoo
Hello!

Okay, So i built a big site on the old CMSMS when it used to do underscores instead of dashes for Page Alias.  I much prefer the dashes and was very happy when the default was changed.

Anyway, I want to change all of the underscores to dashes in int he page alias field.

Here's the query I wanted to use in PHPmyAdmin

Code: Select all

UPDATE `cms_content` SET content_alias=replace(content_alias,’_’,'-’);
However, unfortunately, it doesn't work.  I'm not a smart SQL person and so I can't figure out what's wrong.  Any help appreciated.  Maybe it's just my version of MySQL.

Any other ideas on changing JUSt the Underscores in the content_alias field?

Thank you in advance,
    Shawn

Re: Find and Replace in PHPmyAdmin - Changing _ Underscores to - dashes (Query H

Posted: Mon Apr 23, 2007 11:40 pm
by Nullig
The syntax I found is:

UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");

I wonder if you need to enclose the findstring and replacestring in double quotes?

Nullig

Re: Find and Replace in PHPmyAdmin - Changing _ Underscores to - dashes (Query H

Posted: Tue Apr 24, 2007 12:16 am
by brainpoo
WOW, you ROCK!

It WAS just the " instead of ' for the strings.

Heh, i never thought it would have been something so simple.

Thank you Thank you!