I have these three tables: A, B, and C.
A has a one-to-many relation with both B and C.
Right now, what I am doing is:
I run a select query on A. I put the results on an array, lets say aArray.
For each row in the aArray, I select the corresponding rows from table B and put the results in a two dimensional array bArray.
I do the same for each row in aArray, selecting the corresponding rows from table C.
What I have now is: on array with results from table A, and two two-dimensional arrays with results from B and C.
I do this in my controller. I pass the arrays to my view, and everything is messy. I can make things work this way, but this feels wrong.
Anyone has an idea how I should do this. What I am using is PHP.
thank you in advance.