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!

MSQL Newbie 1

Status
Not open for further replies.

dzon

IS-IT--Management
May 26, 2005
103
GB
Hi,

I have moved our Moodle site to a new server and have one problem left. There are several hundred picture links going to the old server.
After further research I have found out that the links are stored in the MYSQL DB. They are in the table MDL_Quiz-Questions and the field name is called questiontext. here is one of the records from the questiontext field.

<p>The figure below shows a speed-time graph.</p><p><img height="254" alt="Graph" hspace="0" src=" width="256" align="middle" border="0" /></p><p>What distance (in metres) is travelled in 5 secs ?</p>

I need to somehow change olddomain.com to new.domain.com in every record.

Is it possible to write a query or script to seek out olddomain.com and replace with newdomain.com. I manually changed one of these records to newdomain.com and it works fine.

Can anybody help me with this?

Thanks in advance

Dzon
 
You could use:
[tt]
UPDATE `mdl_quiz-questions`
SET questiontext=REPLACE(questiontext,"olddomain.com","newdomain.com")
[/tt]
 
A big thank you Tony!

I would also like to thank Vacunita for assisting me previously.

Cheers,

Dzon
 
You're welcome dzon. I'm glad Tony was able to help you.

Dont you just get that tingley feeling in your toes when you know you've helped somebody out geniunely.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top