I'm developing a site that will have users login and will also include a simple shopping cart. I'm wondering if its better to use cookies, sessions, or a combination of both to keep track of users logged in and anyone (including non-logged in user's) shopping cart contents.
Many developers these days will save a the cart information to a database and place the session ID into a cookie. So to answer your question, yes a combination of cookies and sessions woudl be your best best.
I would however only log either the users session id or their actuall account id in the cookie and nothing more