Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Need some help writing an SQL query for phpMyAdmin
Old 02-16-2012, 10:05 PM Need some help writing an SQL query for phpMyAdmin
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
OK here is the situation.

I relocated a PrestaShop ecommerce website.
Everything works great except for one thing.

Each product within the database has a long description field and usually that description field allows for insertion of an image via the WYSIWYG editor.

So in the new website installation the images are referenced as
http://www.olddomain.com/img/cms/image.png

whereas i need to change them all to
http://www.newdomain.com/img/cms/image.png

Of course I could go through each image and do it manually but with over 600 products that would be a massive time drain.

So.... I am looking for a way to update my database using phpMyAdmin SQL update query.

If it helps;
the database is called PS_MYSHOP1
the table containing the description is called PS_PRODUCT_LANG
and the description field itself is called DESCRIPTION

Any help from SQL gurus welcomed
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-17-2012, 11:43 PM Re: Need some help writing an SQL query for phpMyAdmin
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Bueller? Bueller? Bueller?
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
Old 02-18-2012, 08:20 AM Re: Need some help writing an SQL query for phpMyAdmin
chrishirst's Avatar
Defies a Status

Posts: 43,961
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
UPDATE table SET column = REPLACE(column, 'olddomain', 'newdomain');
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-18-2012, 07:20 PM Re: Need some help writing an SQL query for phpMyAdmin
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Quote:
UPDATE table SET column = REPLACE(column, 'olddomain', 'newdomain');
Thanks Chris.

So the sql query should look like this?

Quote:
UPDATE ps_product_lang SET description = REPLACE(description, 'olddomain' , 'newdomain')
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID

Last edited by TWD; 02-18-2012 at 08:27 PM..
TWD is online now
Reply With Quote
View Public Profile
 
Old 02-19-2012, 08:54 AM Re: Need some help writing an SQL query for phpMyAdmin
chrishirst's Avatar
Defies a Status

Posts: 43,961
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Should be Ok at that and you could always add a WHERE clause to test it on a subset of records before running it against all records.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-19-2012, 08:23 PM Re: Need some help writing an SQL query for phpMyAdmin
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Should be Ok at that and you could always add a WHERE clause to test it on a subset of records before running it against all records.
Sounds good. Could you show me an example of what you mean by the WHERE clause?
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
Old 02-21-2012, 10:04 AM Re: Need some help writing an SQL query for phpMyAdmin
chrishirst's Avatar
Defies a Status

Posts: 43,961
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.w3schools.com/sql/sql_where.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-21-2012, 09:27 PM Re: Need some help writing an SQL query for phpMyAdmin
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Got it. thanks.
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to Need some help writing an SQL query for phpMyAdmin
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24370 seconds with 11 queries