How to add multiple categories through PHP?

Showing Answers 1 - 4 of 4 Answers

Dharma Raj

  • Aug 29th, 2006
 

just add an table in to DB and store ur all products with respective each category, while you retrive form DB, just compare this two table, wheather it has same id or not,

  Was this answer useful?  Yes

anand.k

  • Jul 24th, 2007
 

Select  c.id, m.catogory_name from catogorymaster m, child c where m.catid = c.id;

  Was this answer useful?  Yes

It depends on how those categories are going to be laid out.  if a category will only ever have one parent category and multiple sub-categories then you could use a nested set architecture (where each category has a tree-left and tree-right field and its location is dependant on those number being within the range of other categories left and right number).  

however if categories needed to have multiple parents then you would have to make the table with an external cross reference table to indicate all parents as well as all children of this category.

Both options have advantages/disadvantages, the answer really depends on your needs.

  Was this answer useful?  Yes

abc

  • Sep 12th, 2011
 

Select c.id, m.catogory_name from catogorymaster m, child c where m.catid = c.id;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions