WHERE items ARE in Category_1 OR THEN in Category_2??
Posted: Wed Sep 08, 2010 12:35 pm
Hi.
We have a load of products and want to show best sellers from the category a product is it.
ie. if you sell cars, and you are hundreds of Fords. You want to show a particular Ford page, but then show all your best selling fords.
What if you run out of Fords? You want to then also maybe show Jaguar's or ANY OTHER cars in your Lot.. So your query is a randomly selected query for about 16 items, firstly looking for those Fords in the system, but if you only have 4 Fords, it then finds ANY (*) other products randomly.
Is there something I can add to this script that will do that?
We have a load of products and want to show best sellers from the category a product is it.
ie. if you sell cars, and you are hundreds of Fords. You want to show a particular Ford page, but then show all your best selling fords.
What if you run out of Fords? You want to then also maybe show Jaguar's or ANY OTHER cars in your Lot.. So your query is a randomly selected query for about 16 items, firstly looking for those Fords in the system, but if you only have 4 Fords, it then finds ANY (*) other products randomly.
Code: Select all
$result = mysql_query ("SELECT * FROM products WHERE best = 'yes' AND pause = 'off' AND photoprimary IS NOT NULL ORDER BY RAND() LIMIT 0, 12");