使用此代码:

$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);


我得到了形式的路径
/images/stories/virtuemart/product/1200x1000.gif

从数据库中已经存在的表中获取它,并使用UPDATE转移到另一个表中

试图在名称前添加一个静态字符串,但我不能。
具体来说,我希望新表传达为存储为:

http://www.example.com/images/stories/virtuemart/product/1200x1000.gif

前面的数据增加了:www.example.com

有人可以帮忙吗?

我尝试不成功的方法:

$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);

最佳答案

您需要使用CONCAT函数:

$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);

08-18 10:45