我的代码就是这个
$newentry = "
UPDATE url
FROM auction_media
JOIN auctions ON auction_media.auction_id = auctions.auction_id
SET media_url = '$row2['url']/$match[0]'
WHERE media_type = '3'";
我得到的错误是
解析错误:语法错误,意外T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING
答案 0 :(得分:1)
$newentry = "UPDATE `url` FROM `auction_media` JOIN `auctions` ON `auction_media.auction_id` = `auctions.auction_id` SET `media_url` = '".$row2['url']."/".$match[0]."' WHERE `media_type` = '3'";
答案 1 :(得分:1)
这个片段似乎错了:
SET media_url = '$row2['url']/$match[0]'
更正如下:
SET media_url = '" . $row2['url'] . "/" . $match[0] . "'
请改为尝试:
$newentry = "UPDATE url FROM auction_media JOIN auctions ON auction_media.auction_id = auctions.auction_id SET media_url = '" . $row2['url'] . "/" . $match[0] . "' WHERE media_type = '3'";
答案 2 :(得分:1)
假设查询实际上有效:
$newentry = "UPDATE url
FROM auction_media
JOIN auctions
ON auction_media.auction_id = auctions.auction_id
SET media_url = '" . $row2['url'] . '/' . $match[0] . "'
WHERE media_type = '3'";