我想从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