如何使用两个表创建菜单和子菜单?

时间:2014-04-27 16:13:41

标签: php mysql

请帮助我如何在PHP中使用这些表创建垂直菜单或子菜单。

这两个表格为cat(id,cat_name,main_cat_id)main_cat(id,main_cat_name)

main_category表

id  main_category_name
1   Hotels
2   Compressors
3   Apparel & Clothing
4   Automobile
5   Car Rentals
6   Mobiles & Accessories
7   Computers & Peripherals
8   Doctors
9   Education

类别表

id  category_name   main_category_id
1   Pizza Center    1
2   2 Star Hotel    1
3   Hotel & Restaurant  1
4   5 Star Hotel    1
5   Air Compressor  2
6   Flare Nuts  2
7   Auto Accessories-Car Stereos    4
8   Automotive Parts, Components & Spares   4
9   Motorcycles, Scooters & Two Wheeler Parts   4

0 个答案:

没有答案