I have a site where the user can do a search and specify the number of results to display on each page. The array is the result of a multidimensional array_merge from three different mysql queries (that may sound strange but there's a very good reason for it) so I can't use mysql's LIMIT to limit the number of results I return.
I've got everything but how to return just the specified number of results. Once I get that part I can figure out how to do the incrementing to display results for the subsequent pages.
This is a simplified example of what I'm doing:
if($per_page == "")
$per_page = 20;
$list1 = query blah blah
$list2 = query blah blah
$list3 = query blah blah
$list = array_merge($list1, $list2, $list3);
$numrows = count($list);
do some sorting here..........
if($numrows > $per_page)
{
do some incrementing here if they ask for the next batch of results......
---------this is the bit i need----------
$return_list = the specified number of array results from $list (0-19 or 20-whatever);
}
else
{
$return_list = $list;
}
Then it get's passed to a template that loops through the results and displays them.
I hope that wasn't too vague. I know this has to be really simple but it's the simple things that always seem to trip me up 😉
Much thanks in advance.