In many webshops the customer has to login/register after the product selection is done. With the db_cart class it's possible to handle shopping carts with and without a customer ID.
Important
If you don't want to use a customer ID you need to leave the property in the constructor empty (or use a zero):
$object = new db_cart();
or if you don't know if a customer is logged in use the code like:
if (empty($customer)) $customer = 0;
$object = new db_cart($cutomer);