[eluser]M52 Studios[/eluser]
Hey everyone,
This has been bothering me for some time, and I honestly don't even know what to search for(topic seems too broad).
I really like the MVC pattern approach, and want to abide by it as much as possible while developing apps, but I've been struggling with the following issue for quite some time.
I understand querying the data from the database and then sending it over to the view. My question is what do you when there is a need to query another database table, and the query is dependent on what is displayed in the view. Let me explain.
For instance. Say I have a table that stores all the clients with some of their specs and I need to display that to a view in a with most information already in that table. Then I come to the point where I need to display their pictures, and the picture reference is stored in a different table. So what is the best way to go about solving this? Do I just call the model to query that table from the view(that is what I have been doing)? Or is there an actual procedure that has already been developed and is widely accepted as the proper way to approach this.
pseudo code:
foreach customer-query
display the information
query the database for pictures
foreach picture-query
display picture
I apologize for the lengthy post and very much appreciate your input!
-Ilia