Custom Template containing Extra Tables with Databasejoin Elements

flodg3

New Member
I'm making a custom template which uses queries to collect data from tables other than the main table. The problem that I am having is with the data that is being displayed. One of the extra tables has a databasejoin element. I know that only the id is saved. What would be the easiest way of grabbing data from the other table using that id? I have considered using an additional query to lookup the information each time, but this seems inefficient.

The first image shows what the extra table ("Lodges") looks like in its own view.

The second image shows what Lodges looks like in the custom template.

The third image shows the code that I am using in the custom template to generate the Lodges "sub" table.

In the Lodges table, there is a databasejoin element with the "Meetings_Days" table. The final image shows what week day table looks like ("Meetings_Days").

I have spent many days trying to figure this out and I'm ready to try anything. Any thoughts would be really appreciated.
 

Attachments

  • Lodge_Table.png
    Lodge_Table.png
    73.6 KB · Views: 202
  • custom_list_template_output.png
    custom_list_template_output.png
    38 KB · Views: 191
  • custom_list_template.png
    custom_list_template.png
    75.2 KB · Views: 194
  • Meeting_Days_Table.png
    Meeting_Days_Table.png
    143.9 KB · Views: 194
Friendly bump.

I am still struggling to understand how to access alternate tables through PHP code. If someone is able to point me to some pages or examples that I may have missed, that would be much appreciated.
 
Friendly bump.

I still haven't made any progress. Does anyone have any thoughts or recommendations?
 
hi
I'm not 100% sure of the relationship you are trying to define between the two tables but in general you would join from the lodges table to the meeting table.

So in this generic example to get all lodges and their meetings:

select * from lodge LEFT JOIN meetings ON meethings.lodge_id = lodge.id
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top