0
我有這樣如何使用數組變量到MySQL查詢在PHP/MySQL的
$variable[] = $data['master_software_capability_id'];
一個數組變量如何在SQL查詢
這是正確的方式使用該數組變量?
SELECT * FROM software_capability where software_capability_id IN ($variable);
我有這樣如何使用數組變量到MySQL查詢在PHP/MySQL的
$variable[] = $data['master_software_capability_id'];
一個數組變量如何在SQL查詢
這是正確的方式使用該數組變量?
SELECT * FROM software_capability where software_capability_id IN ($variable);
您需要的陣列內爆,以逗號分隔字符串
$variables_imploded = implode(",",$variable);
"SELECT *
FROM software_capability
where software_capability_id IN
(".$variables_imploded.")";
使用JOIN或破滅
$variables_joins = join(',',$variable);
SELECT * FROM software_capability where software_capability_id IN ($variables_joins);
由於abhik其工作。 – Senthilkumar
非常歡迎您! –
@Senthilkumar請接受這個答案,因爲它會被標記爲已解決 –