[eluser]Unknown[/eluser]
I have been using Codeigniter for about 2 weeks, and I'm really impressed with how quick it is to write this code. I apologise for what is probably a noob question but I've had a good look through the forum and on google and can't find the answer.
My project is a customer database. I am trying to make a page which displays the customer's details, then has a list of notes for this customer. Within each note is a piece of text, then a list of photos relating to the note. I guess it's similar to someone's facebook page, which has a list of wall posts then each post can contain several photos.
The problem is, when I load the customer view, I am listing the notes as follows:
Code:
<? foreach($notes as $note) {
echo $note->posted_time;
echo $note->message;
// list photos for this note here.
} ?>
So each individual note is seen for the first time inside the view. I need to query the photos database for photos with the note_id equal to $note->id, but this must be called from the model / controller, not the view.
Please help if you have any ideas! I am sure this kind of 'list within a list' must be quite common?
Dave