I need a mysql query dynamically generated from post data.
This is the table structure of the table which needs to be queried:
The post data prints like this:
[tags] => Array
[param] => all
[value] => Array
 => 1
 => 2
The value array above is the array of tag_id and is chosen from a multiple select list so any number of tag_id's can be in that array.
The query i would need to create based on the post data above would need to select any contact (c_id) which is assigned to both tag 1 and tag 2.
In the case of the table above c_id 1 would be selected but not c_id 2.
The basic query used to select this is
SELECT c1.c_id FROM tag_table c1 JOIN tag_table c2 on c1.c_id = c2.c_id WHERE c1.tag_id = 1 AND c2.tag_id = 2
However I need this to be generated dynamically.