<p>How can I use a database and PHP sessions to store a user's shopping cart? I am using CodeIgniter, if that helps.</p>

<p>Example code would also be nice.</p>

I would recommend that you look at
the CodeIgnitor Session Class
.
Additionally, you could look at
Chris Shiflett's discussion
on this topic.