First let me state that I've never done shopping carts. But it sounds to me that it will work. The session info is stored in /tmp on my Slackware server.
On the other hand, I wonder why you store the temporary shopping cart in a mysql database and not in the session itself? It would save you the hassle
But you might have a very good reason (e.g. max filesize for session file).
Code:
$_SESSION['items'][$item_id]=$number_of_items; /* item_id is a unique key from the db and the assigned value is the number of items that the visitor wants to purchase*/
$_SESSION['items'][33]=2;
$_SESSION['items'][345]=4;
If you want to keep track of the costs
Code:
$_SESSION['items'][33]['cost']=311.25;
$_SESSION['items'][33]['num']=2;
$_SESSION['items'][345]['cost']=12.50;
$_SESSION['items'][345]['num']=4;
Once the visitor submits, you store the items from the session in the database.