0

I am trying to create a component which uses 3 tables in the database. I want to link the first table with the second one, then second with third.

To be more precise, consider this :

  1. Category: id, name
  2. Sub category: id, category_id, name
  3. Sub sub category: id, subcategory_id, name

I have created models, controllers and views for all the three tables. Just want to know how to link them together so that on the list view of Categories, I can have a link for subcategories and on clicking on that link, I can show the subcategories for the category.

I have googled this for almost 3 days now. But can't find an answer.

Any help is appreciated.

technocloud
  • 122
  • 6
  • I'd suggest you to use native Joomla categories. More info can be found here: http://tormix.com/joomla/how-to-use-jcategories-in-my-component.html – di3sel Oct 28 '13 at 19:33
  • I just used categories for example. Its actually 3 different tables. – technocloud Oct 29 '13 at 07:01
  • If you're using Joomla 1.6 or newer you don't need to create any tables, all your categories are stored in #__categories table. That saves alot of time and work in editing and listing categories. – di3sel Oct 29 '13 at 07:03
  • Ohh.. may be I am not clear. Actually, I want to create Courses, chapters and then tests. So each course will have chapters, each chapter will have tests etc.. I used categories just for the example. – technocloud Oct 30 '13 at 09:12
  • Just taking a stab here, but have you tried setting your engine type for these tabes as innodb and using foreign keys for relationships? the you would use joins in you mysql query. – TEN Design Oct 30 '13 at 16:37

0 Answers0