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'";

我得到的错误是

解析错误:语法错误,意外的 T_ENCAPSED_AND_WHITESPACE,需要 T_STRING 或 T_VARIABLE 或 T_NUM_STRING

4

3 回答 3

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'";
于 2013-01-23T18:34:25.510 回答
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'";
于 2013-01-23T18:34:45.927 回答
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'";
于 2013-01-23T18:35:02.743 回答