Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add / after and before a music url path

Status
Not open for further replies.

Edward07

Programmer
Apr 13, 2007
49
NL
Hi all. I have around 1200 music url records. I wanted to change all the url path from:

Code:
[URL unfurl="true"]http://music.somesite.com/IlIlIlIIIll11lIlI44/cindy/life/power[/URL] of life.mp3
to
Code:
[URL unfurl="true"]http://music.somesite.com/songs/cindy/life/power[/URL] of life.mp3
I had in mind to use this query:
Code:
UPDATE musicurls
SET filename= CONCAT( SUBSTRING_INDEX(filename, '/', 3), '/songs/', SUBSTRING_INDEX(filename, '/', -3) )
But by mistake i run this query:

Code:
UPDATE musicurls
SET filename= CONCAT( SUBSTRING_INDEX(filename, '/', 3), 'songs', SUBSTRING_INDEX(filename, '/', -3) )
Now all the urls looks like this which are not correct
Code:
[URL unfurl="true"]http://music.somesite.comsongscindy/life/power[/URL] of life.mp3
could any one show me how to fix these urls so there is a slash / after and before songs word for all
the 1200 url records?I am using phpmyadmin and don't know if there is any role back or undo function in mysql and phpmyadmin.
Mainly i want the first part of all urls be
Code:
[URL unfurl="true"]http://music.somesite.com/songs/[/URL]
instead of
Code:
[URL unfurl="true"]http://music.somesite.comsongs[/URL]
 
Before you do anything - make a couple of back up copies and store them away from your working directory.
It would be easier doing that kind of manipulation using a programming language rather than a query as you have much more control.
Doing it that way, you could create a table from the actual files in the directory.


Keith
 
Thanks for your reply. Unfortuenlty i alread run the update so all the 1200 url records has start part like:

Code:
[URL unfurl="true"]http://music.somesite.comsongs[/URL]
instead of
Code:
[URL unfurl="true"]http://music.somesite.com/songs/[/URL]

Could any one show me a query that can fix all these incorect urls?Thanks in advance
 
could you tell me the format of replace? I am using mysql with phpmyadmin.thanks
 
opps. i found it myslef using :

update tablename set field = replace(field,'search_for_this','replace_with_this');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top