show item from each category
i have 10-12 CATEGORIES and i want to show 1 most recent added product of each CATEGORY on my homepage
There is "category_id" in product_table
So should i repeat this code 10 times and replace category id.
$qry = "SELECT * FROM product_table where category_id=1 order by product_id desc LIMIT 0,1";
$result = mysql_query($qry);
while($row = mysql_fetch_array($result))
echo $row['product_id'] . "--". $row['product_name']. "<br>";
Or is there any other shorter solution ??
I mean can this be done in one single query ???