i did a test with the following query:
SELECT * FROM ps3_products WHERE ps3_products.ProductID = 2 OR ps3_products.ProductID = 13 OR ps3_products.ProductID = 6 OR ps3_products.ProductID = 20
using powerstores product database.
then created the critiria session as:
<?php
$_SESSION["criteria"][] = 2;
$_SESSION["criteria"][] = 13;
$_SESSION["criteria"][] = 6;
$_SESSION["criteria"][] = 20;
?>
and using the following code:
<table width="200" border="1">
<?php $j=0; ?>
<?php do { ?>
<?php for($i = 0;$i < $totalRows_rslastfiveviewed; $i++) { ?>
<?php if($_SESSION["criteria"][$j] == $row_rslastfiveviewed['ProductID']) { ?>
<tr>
<td><?php echo $row_rslastfiveviewed['ProductID']; ?></td>
<td><?php echo $row_rslastfiveviewed['ProductName']; ?></td>
</tr>
<?php } ?>
<?php $j++; } ?>
<?php } while ($row_rslastfiveviewed = mysql_fetch_assoc($rslastfiveviewed)); ?>
</table>
got the correct order output of 2, 13, 6, 20, the order of the items in the array.
I used a different order in the array just to make sure the array was effecting the output on the page.