Reputation: 3
with this code:
$result = mysql_query("
UPDATE skroutz SET
Image_Link=(
SELECT file_url
FROM bonnie_virtuemart_medias
INNER JOIN bonnie_virtuemart_product_medias
ON bonnie_virtuemart_medias. virtuemart_media_id =bonnie_virtuemart_product_medias. virtuemart_media_id
WHERE virtuemart_product_id=Unique_ID LIMIT 1)",$db);
I get a path of the form /images/stories/virtuemart/product/1200x1000.gif
Get it from table in my database that already exists and the transfer to another table with UPDATE
Trying to add a static string in front of the name but I can not. Specifically, I want the new table to convey stored as:
http://www.example.com/images/stories/virtuemart/product/1200x1000.gif
That adds to data in front the: www.example.com
Can someone help?
What I tried without success:
$result = mysql_query("
UPDATE skroutz
SET Image_Link=('www.example.com'
SELECT file_url
FROM bonnie_virtuemart_medias
INNER JOIN bonnie_virtuemart_product_medias
ON bonnie_virtuemart_medias. virtuemart_media_id =bonnie_virtuemart_product_medias. virtuemart_media_id
WHERE virtuemart_product_id=Unique_ID LIMIT 1)",$db);
Upvotes: 0
Views: 37
Reputation: 1527
You need to use the CONCAT function:
$result = mysql_query("
UPDATE skroutz
SET Image_Link=(
SELECT CONCAT('www.example.com', file_url)
FROM bonnie_virtuemart_medias
INNER JOIN bonnie_virtuemart_product_medias
ON bonnie_virtuemart_medias. virtuemart_media_id = bonnie_virtuemart_product_medias. virtuemart_media_id
WHERE virtuemart_product_id=Unique_ID LIMIT 1)",$db);
Upvotes: 1
Reputation: 17289
Since I made update of your question it is obviously that you are trying something strange.
If I got your goal correctly you can try something like:
SET Image_Link=CONCAT('www.example.com',(
SELECT file_url
...
))",$db);
Upvotes: 0