I have and array with two values and I want to use it with sql IN operator in select query.
Here is the structure of my table
id comp_id 1 2 2 3
you need to convert the array into comma-separated string:
$condition = implode(', ', $arr);
And, additionally, you might want to escape the values first (if you are unsure about the input):
$condition = implode(', ', array_map('mysql_real_escape_string', $arr));