I have an array variable like this
$variable[] = $data['master_software_capability_id'];
How to use this array variable in SQL query
Is this the right way ?
SELECT * FROM software_capability where software_capability_id IN ($variable);
I have an array variable like this
$variable[] = $data['master_software_capability_id'];
How to use this array variable in SQL query
Is this the right way ?
SELECT * FROM software_capability where software_capability_id IN ($variable);
You need to implode the array to comma separated string
$variables_imploded = implode(",",$variable);
"SELECT *
FROM software_capability
where software_capability_id IN
(".$variables_imploded.")";
use JOIN or IMPLODE
$variables_joins = join(',',$variable);
SELECT * FROM software_capability where software_capability_id IN ($variables_joins);