[thelist] php/mysql: a more efficient method of doing this

Burhan Khalid thelist at meidomus.com
Wed Apr 2 15:37:21 CST 2003

Dunstan Orchard wrote:
> Hi there,
> I'm running a little bit of code that checks to see if an item is in a user's 
> cart or not.
> If it's not it prints the '+' link, if it is then it prints the '-' link.
[ snip ]

> I'd like to know if there's a more efficient way of doing this check.

I would suggest storing the list of current items in the shopping cart 
in an array and then storing that in a session variable. This way, you 
will save a trip to the database.

Burhan Khalid

More information about the thelist mailing list