thanks for the logic Jason.
i had a go, and depending on how I organise the loops, i get a different result, (neither being the one I want).
I also output the array values in order to check my results, (in red)
First attempt...
<?php do { ?>
<?php for ($i = 0; $i < $totalRows_rslastfiveviewed; $i++){ ?>
<?php print_r ($_SESSION["criteria"][$i]); ?>
<?php if ($_SESSION["criteria"][$i] == $row_rslastfiveviewed['ItemID']) echo $row_rslastfiveviewed['ItemName']; ?>
<?php } ?>
<?php } while ($row_rslastfiveviewed = mysql_fetch_assoc($rslastfiveviewed)); ?>
This results in the array value [$i] being matched in every increment, but in the same order as in the recordset, ie ItemID
Second attempt...
<?php for ($i = 0; $i < $totalRows_rslastfiveviewed; $i++){ ?>
<?php do { ?>
<?php print_r ($_SESSION["criteria"][$i]); ?>
<?php if ($row_rslastfiveviewed['ItemID'] == $_SESSION["criteria"][$i]) echo $row_rslastfiveviewed['ItemName']; ?>
<?php } while ($row_rslastfiveviewed = mysql_fetch_assoc($rslastfiveviewed)); ?>
<?php } ?>
This loops through until I get a match, but I only get one result returned, (although it is the correct one)
can you help me with the logic please ?