I've got a require file that I use to display random products. On the home page it gets used twice, once in the main content section and then again in the sidebar.
The problem I'm having is the second require doesn't overwrite the first sql results, it adds to them? The results I'm actually getting for the 2nd set of results are the 1st set plus the 2nd.
Here's the first bit of code I use to select the products:
SELECT id FROM
prods
ORDER BY RAND() LIMIT 10
Then this uses those to fill out the rows:
SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM
prods
WHERE id IN ('.$sqlIn.') GROUP BY name ORDER BY RAND()
I'm sure I've overlooked something but can't think what it is.