Hi, I have the following code which currently limits the result into a couple of types (Banana, Orange or all):
function selectFromArray($prefix="", $productArray=array()) {
if(!strlen($prefix)) return $productArray;
return array_filter($productArray,
create_function('$element',
'return (stripos($element[1],'.var_export($prefix, true).') === 0); '));
}
$setype = $_GET[stype];
$list = selectFromArray($setype, $list);
foreach($list as $r)
{
$size2 = $r[2];
echo "<tr>
<td id=\"id\"><span id=\"non_sorting_header\">" .$r[0]. "</span></td>
<td id=\"name\"><span id=\"non_sorting_header\">" .$r[1]. "</span></td>
<td id=\"speed\"><span id=\"sorting_header\">" .kMGTB2($size2). "</span></td>
<td id=\"download\"><span id=\"sorting_header\">" .$r[3]. " Gb<br />per month</span></td>
<td id=\"contract\"><span id=\"sorting_header\">1<br />month</span></td>
<td id=\"info\"><span id=\"non_sorting_header\">".$r[5]."</span></td>
<td id=\"buy\"><span id=\"non_sorting_header\">£".$r[4]."<br />".$r[6]."</span></td>
</tr>";
}
$r[0] is the product type and $setype = $_GET[stype]; sets the product type.
I need to combine the code above with a way of limiting the results further by using $r[0] which is the id value in the array. The array is created from an XML query from another site - so I have no control over it, so its not just a case of removing the entries from the array.
For instance the array can have upto 50 different id's in it but I want to limit the ones displayed in the table to just 10 (1024,1045,1023 etc).
Please help this is doiung my head in!!!!