我有多個複選框,其中包含類別名稱及其值。每次提交表單後都會生成一個數組。從動態php數組構建mysql查詢
這裏是例子:
Array
(
[user_type] => Array
(
[0] => Freelancer
[1] => Company
)
[category] => 19
[sub_category] => Array
(
[0] => Website UI Designing
[1] => Website Development
)
)
現在我從上面陣列要建立一個MySQL查詢像---
select * from table_name
where user_type in ('Freelancer','Comapny')
and category in (19)
and sub_category in ('Website UI Designing','Website Development')
任何幫助將不勝感激。 感謝
類別是否總是給出一個值,並且該值太整數? –
你在使用準備好的語句嗎? – Steve