解析错误mysql 2个变量

我的代码是这样的

$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


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

这段代码似乎是错误的:

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

假设这个查询实际上会起作用:

$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'";
链接地址: http://www.djcxy.com/p/69931.html

上一篇: parse error mysql 2 variables

下一篇: Parse error received on unexpected T