I m working on a filter and sort option for a website and seem to be stuck. The whole code can be seen here: http://pastebin.com/pYfnLiSZ
It's not 100% complete ... parts like this
if(array_key_exists('number', $sorts))
{
$issue = $sorts['number'];
$setIssue = "AND i.item_number = ?";
}
still need to be edited a bit, but I hope it's understandable.
The part that I can't figure out is this(line 126 in pastebin):
if( !empty($userIDS) && $letter )
{
$ref = array();
foreach($userIDS as $id)
{
$ref[] = $id['followed'];
}
$ref[] = $letter;
$params = implode(",", array_fill(0, count($userIDS), "?"))."?";
$prep = implode("", array_fill(0, count($userIDS), "i"))."s";
}
I'm not sure how to make the above if dynamic. I only need it if $userIDS array is not empty and either $letter or $year or $publisher or $number are set. So it can basically be any combination. Items belonging to the users in the $userIDS array and filtered by letter, year, publisher, number and maybe in the future other filters. Or it can be year and publisher, or publisher, number and year ... and so on.