I am building an ecommerece site for food shops .
I have 2 tables
shop_categories and shop_prodcuts
shop_categories:
Shop_ID ->PK
shop_cat_id ->fk
shop_cat_name
shop_cat_photo
shop_cat_descrription
shop_prodcuts:
Product_ID -> PK
shop_ID -> fk
product_name
price
Description
I want to make a page to display all the categories avaliabe in a certain shop
I have a shop_ID passed from a pervious PhP page
and I made the select statement :
select shop_cat_name , product_name, Description , price
from shop_categories , shop_prodcuts
where shop_categories.shop_cat_id = shop_product.shop_cat_Id
and shop_categories.shop_ID = $shopid (the passed variable)
order by cat_name
now I have all the category names and all the products name
the problem in the way of displaying these data :
I want to make a PhP display in a shape like this
SHOP NAME : McDonalds
Category :
1-Chicken
Products:
1-burger
Description of the sandwitsch in a smller font
2-hot
Description of the sandwitsch in a smller font
3-not burger
Description of the sandwitsch in a smller font
4-not hot
Description of the sandwitsch in a smller font
.... etc
2-Meat
Products:
1-burger
Description of the sandwitsch in a smller font
2-hot
Description of the sandwitsch in a smller font
3-not burger
Description of the sandwitsch in a smller font
4-not hot
Description of the sandwitsch in a smller font
.... etc
I have a problem arranging the data in this format ; displaying each category then each products ; then the next one with its products
any help please ?
and sorry for bothering