Welcome, Guest
Username: Password: Remember me

TOPIC: Linking Tables

Linking Tables 22 Sep 2012 16:09 #3850

  • sdm7001
  • sdm7001's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Please be patient with me as I am a noob.

I am trying to link tables using the foreign key but I am not sure how to do it in this platform.

OK, stop laughing. I have looked all over this forum and have not found an answer or a How To Manual.

I appreciate the assistance.

SDM
Last Edit: 03 Oct 2012 13:30 by admin.
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:00 #3852

  • sdm7001
  • sdm7001's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Sorry ...thought I had figured it out but I was unsuccessful. Any help would be sincerely appreciated.
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:25 #3854

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi and welcome!
  1. Ok so lets say your tables are called table1 and table2 and you have an id and title for each.
  2. Table1 is your main table, table2 your secondary table containing related records for each in table1.
  3. Add a field of typeForeign Key to table 1 and call it Foreign.
  4. Once you've saved that field, you'll notice a box in the foreign table column of your fields grid with a broken line (- - - - ).
  5. Drag table 2 from the tables list on the left into this area.
  6. Now, when you add a Page (layout) for table1, drag all of it's available fields to the layout, you'll be able to edit the properties of that field on the layout to select which related field you want to be displayed as it's labe - for example, title. This will store table2.id as the value but display it's title.

Hope this helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin, sdm7001

Re: Linking Tables 22 Sep 2012 17:27 #3855

  • sdm7001
  • sdm7001's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Thank you very much!!
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:30 #3857

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Check it works before you thank me LOL
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:44 #3859

  • sdm7001
  • sdm7001's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Works great. The only thing I don't see the the visual connection between the tables.
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:53 #3860

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
You can see the ERD in the projects tab by clicking database - I think.

Glad it helped!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:55 #3861

  • sdm7001
  • sdm7001's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
A simple refresh took care of it.
The administrator has disabled public write access.

Re: Linking Tables 22 Sep 2012 17:57 #3862

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Great!
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
Time to create page: 0.072 seconds

Get Started