0

转义后写的正确语法是什么?

("SELECT torrent_download
FROM " . DB_PREFIX . "auctions WHERE
                auction_id='" . $item_details['auction_id'] . ); 

我得到的错误是意外的')'

我尝试了各种 " 和 ' 但似乎没有一个工作

4

3 回答 3

6

看起来您在 final 之前缺少一个结束语',它会用双引号括起来$item_details['auction_id'])"'");

("SELECT torrent_download
  FROM " . DB_PREFIX . "auctions WHERE
            auction_id='" . $item_details['auction_id'] . "'");

为了在双引号字符串中节省一点麻烦,我建议使用{}附件而不是连接所有引号。但是,您不能将常量 括起来DB_PREFIX

("SELECT torrent_download
  FROM " . DB_PREFIX . "auctions WHERE
        auction_id='{$item_details['auction_id']}'");
于 2012-05-01T21:02:27.297 回答
1
("SELECT torrent_download
 FROM " . DB_PREFIX . "auctions WHERE
            auction_id='" . $item_details['auction_id'] . "'");

你试过吗?又是“后跟”。

于 2012-05-01T21:03:13.797 回答
0
("SELECT torrent_download
FROM " . DB_PREFIX . "auctions WHERE
            auction_id='" . $item_details['auction_id'] ."'" ); 
于 2012-05-01T21:02:50.697 回答