我想从数组更新查询。问题是当我运行代码时,数据库中的更新数据只是第一个数据..
例子..
该数组由整数类型 = [1,2]
当我运行代码时,数据库中的数据只运行了第一个数据(只有 1 个)..我该如何解决这个问题?
PHP 文件
$query_edit_paket = "select nama_menu from menu where id_menu = 149 ";
$query_exec_edit_paket = mysql_query($query_edit_paket) or die(mysql_error());
$nama_menu_query = reset(mysql_fetch_assoc($query_exec_edit_paket));
$_fbexclude = mysql_query("select id_paket from detail_paket where menu_paket = '$nama_menu_query' ");
$fbexcludearray = array();
while ($row = mysql_fetch_assoc($_fbexclude)) {
$fbexcludearray[] = $row['id_paket'];
}
$excludes = implode(',', $fbexcludearray);
echo $excludes;
for($i=0;$i<count($excludes);$i++)
{
if($excludes != "")
{
$strSQL = "update paket set ketersediaan_paket ='kosong' ";
$strSQL .="WHERE id_paket = '$excludes' ";
$objQuery = mysql_query($strSQL);
}
}
谢谢!!