SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Wizard silver trophy
    Join Date
    Aug 2003
    Location
    Southern California
    Posts
    4,686
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Help needed in using an array to replace nested sql queries

    Running into some trouble with the MVC approach and I think it's a result of "old world" thinking. Basically I'm trying to understand how to implement the right array structure to aovid nested querying [potentially requiring me to put the query into the view].

    For the sake of the question I've simplified the structure.

    I've got two tables:

    list
    list_id,
    list_name,
    list_createddate

    list_items
    item_id,
    list_id,
    item_name,
    item_photo

    What I want to display out is the list name and the items under it. Those items are essentially infinite as is the number of lists so it's not a simple join issue.

    How would I go about building an array structure to collect both the top level list details as well as the corresponding, and potentially infinite, list item records in my model then loop them back out to a view and thus avoid stacking up queries?

    Thanks!
    Last edited by Ted S; May 2, 2011 at 09:31.
    - Ted S


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •