Reference id is set to the cart session id. With each submitted order I am getting a string of numbers and letters in the database field OrderReferenceID. So far so good.
Next I tried filtering the recordset by OrderReferenceID. I did that by adding "WHERE OrderReferenceID = colname" to the SQL statement, and then added the variable colname with the "values numeric, -1, $_SESSION['OrderReferenceID'] ".
I used the recordset to fill in the fields for the order confirmation email. With the filter the recordset does not return any value in the confirmation email. Without the filter and the order set to desc, the values are displayed correctly in the confirmation email.
I am stuck there. I think it is not reliable enough to let ORDER DESC pic the latest entry it the table, because two orders might be submitted simultaneously. I would like the session ID to be the determining factor which recordset is chosen for the confirmation email.
Is that possible? And if it is, how do I do that?