the session variable $_SESSION["criteria"] contains an array of integer variables.
an example would be
Array ( [0] => 32 [1] => 134 [2] => 135 [3] => 143 [4] => 2 )
which reflects the order they were added to the array
when an additional item is viewed, the first element is removed from the array and another is added to the end, so it has a maximum of 5 elements
for example, adding itemid = 5 to the above array would produce the following array...
Array ( [0] => 134 [1] => 135 [2] => 143 [3] => 2 [4] => 5)
the select statement based on the first array would be as follows...
SELECT ItemID, ItemTypeID, ItemName, ItemImageURL, ItemThumbnailURL FROM tblitem WHERE ItemID = 32 OR ItemID = 134 OR ItemID = 135 OR ItemID = 143 OR ItemID = 2