Click to See Complete Forum and Search --> : Basket query/s 1 or many?


knowj
03-20-2008, 09:39 AM
I have an array stored within a session in PHP which i plan to loop out of to produce the product codes and quantities.

Basically if i had 7 products in this array would it be more efficient to run 7 simple queries or 1 query using OR to get each product?

thanks in advance
J

Or is there a more effective method?

chazzy
03-20-2008, 05:48 PM
the array has products or product id's?

either way, for performance reason 1 query is better than 7.

knowj
03-20-2008, 08:01 PM
ye its unique product ID's

Is it effective to use 'OR`s' within the query for each of the products though?

Nedals
03-20-2008, 08:46 PM
ye its unique product ID's

Is it effective to use 'OR`s' within the query for each of the products though?
Better to use IN..
where productID IN (1,2,3,4)

chazzy
03-20-2008, 10:57 PM
Better to use IN..
where productID IN (1,2,3,4)

Yes, this would be the best approach.