Can a query be used inside another query [on hold]
This is the database
id Name Type Price
1 Apple Fruit 10
2 mango Fruit 8
3 Cabbage vegetable 10
4 Tomato vegetable 7
5 Jasmin flower 10
It should display like the heading should be the type and in a list it
should display name and price.If i add a new type to the database then it
should dynamically generate a div and display the item.All the div are
generated dynamically.Is it possible? i am using this to fetch the type
and i am echoing it but the problem is i need the different names to be
echoed in the same div
$get = MySQL_query("SELECT DISTINCT type FROM product_details WHERE id > 1
ORDER BY id DESC");
if(mysql_num_rows($get) !== 0)
{
while($get_row = MySQL_fetch_assoc($get)){
echo'
'.$get_row['type'].' '; }}
i need to put the name in div class name and price in div class price but
this will loop only 1 and only 1 name and 1 price will be displayed
No comments:
Post a Comment