Welcome Guest, Not a member yet? Register   Sign In
Getting query results using data from another query, then displaying it in a view
#1

[eluser]kwhitaker[/eluser]
Good afternoon all,

So I've got three tables - items, images and associations, and I need to write a view that displays each item with the image that it's associated with.

Here's how the logic of the tables works:

Each item can only have one image, but each image can be associated with multiple items. The associations table takes the itemid and pairs it with an imageid.

Now I could write the items query in my controller, and then write the thumbs query in my view, but that wouldn't be very MVC, would it?

So right now I have this code:
Code:
$data['query'] = $this->db->get('items');
$this->load->view('view_items', $data);

How would I use the items query to populate a thumbs query for each item and then pass that data onto the view?

Any help is appreciated.


Messages In This Thread
Getting query results using data from another query, then displaying it in a view - by El Forum - 06-23-2008, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB