does this mean you write a sessionid to the database for each customer
Well, no. This is more than I wanted to do, and this is just scribbling, but something like:
//--- when the items goes into the cart ------
$query = "insert into cart_table (ItemID,AddTime,Qty) ";
$query .= "values ($ItemID,NOW(),$Qty)";
$rsInsert = mysql_db_query($db_name,$query);
//--- Then to get the cart items ------
$query = "select * from resources_catalogue_list,cart_table WHERE ";
$query .= "resources_catalogue_list.id='$value' ";
$query .= "and cart_table.ItemID='$value' ";
$query .= "order by cart_table.ID";
$rsSelect = mysql_db_query($db_name,$query);
//--- where cart_table has an autoincrimenting ID column ---
Simply add another field to your DB and use that as a marker of what product was selected 1st
So...... a column for every customer?