我想從Mysql_query中排除'ID',但它仍然返回提到的ID。 此ID爲'21',但查詢返回'21',這不是我想要的。 我在Mysql中拼錯了什麼?PHP:Mysql(「SELECT WHERE ID NOT」)
("SELECT * FROM `gallery` WHERE `gallery_id` NOT IN ('$notgallery')") or die (mysql_error());
function not_gallery($pic){
$pic = $_GET['id'];
$id = explode(".", $pic);
$notgallery = $id;
$notg = mysql_query("SELECT * FROM `gallery` WHERE `gallery_id` NOT IN ('$notgallery')") or die (mysql_error());
while($not_row = mysql_fetch_assoc($notg)){
$notgimage[] = array(
'id' => $not_row['gallery_id'],
'user' => $not_row['user_id'],
'name' => $not_row['name'],
'timestamp' => $not_row['timestamp'],
'ext' => $not_row['ext'],
'caption' => $not_row['caption'],
);
}
print_r($notgimage);
}
我print_r'ed查詢和它仍然返回 '21',這我已經排除/或我想我做到
Array ([0] => Array ([id] => 21 [user] => 18 [name] => NotDeojeff [timestamp] => 1367219713 [ext] => jpg [caption] => asd) [1] => Array ([id] => 22 [user] => 18 [name] => NotDeojeff [timestamp] => 1367225648 [ext] => jpg [caption] => Ogre magi)
你可以print_r'$ _GET ['id']'和'$ notgallery'嗎? – 2013-05-02 14:52:18
嘗試回顯查詢(不是結果)。它的內容是什麼? – 2013-05-02 14:52:58
Array([0] => 21 [1] => jpg)21.jpg – Belzelga 2013-05-02 14:53:35