Join Tables over a hierarchy

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 3, 2011   (RSS)

Re: [ryanGT] Join Tables over a hierarchy

By Jason - August 2, 2011

Hi Ryan,

Are you currently able to get all of the information you need as 3 different arrays (ie, 3 different database calls)?

If so, the easiest solution would be to use array_merge() to combine them all into 1 array like this:

<?php
$mergedArray = array_merge($tableARecords, $tableBRecords, $tableCRecords);
?>


Does this sound like what you're looking for?

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Join Tables over a hierarchy

By ryanGT - August 2, 2011

Hi Jason,

Yeah that sounds like it might do it.

Could you give me an example of how i would extract the title information from tableB (assuming the field name would be title)?

If you can tell me that i should be able to figure the rest out

Cheers - Ryan

Re: [ryanGT] Join Tables over a hierarchy

By Jason - August 3, 2011

Hi Ryan,

Are all three queries just returning a single record? If so, and if you need to output information from each table individually, you'd probably be better off just referencing the records one at a time. For example:

Table A Title: <?php echo $tableA['title'];?>
Table B Tile: <?php echo $tableB['title'];?>


Would this work for you? If not, could you please attach the .php file you are currently working with and I'll see if I can make any suggestions.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/