I have the following array
$exclude = array(1 => array(1,2,3,4), 2 => array(1,2,3,4));
I need to exclude the values inside the inner array when the key validates. I'm not sure if I should be using CASE or just AND and OR.
Here is the start to what I attempted, but I am missing something, as this doesn't work as intended.. I am appending the query to the end of a WHERE clause, so that is the only part I have access to.
foreach($exclude as $blogID => $post_ids) {
$ids = implode(',', $post_ids);
if($blogID == 1) {
$where .= " AND table.BLOG_ID = {$blogID} AND table.ID NOT IN ($ids)";
} else {
$where .= " OR table.BLOG_ID = {$blogID} AND table.ID NOT IN ($ids)";
}
}
AND/ORcombinations like this. It might be better to generate a query for each pair, and combine them withUNION.