Jump to content

array to query to array, and counting the items in the process


Cinner

Recommended Posts

Hey guys, I'm building a shopping cart system for myself, and could use some help.

 

My MYSQL database has a table called PRODUCTS, with the following fields: ID | TITLE | TYPE

 

I have a shopping basket array (called $items) containing product ID's, for example: 1, 3, 2, 2, 3, 3.

 

I can query the products from my database, based on the ID's in that array. But I would like to count the corresponding TYPEs of those products, and I'm not sure how (the TYPE is not in the array)? I need to know (count) how many times an ID was placed in the $items array, and what the corresponding TYPES are by querying the database (so I can say TYPE x was placed x times in the shopping basket).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.