Gathering data from multiple tables to show ownership of something

Discussion in 'Databases' started by timallard, Apr 23, 2009.

  1. #1
    Hello,

    Ok I am working on a database application where a USER can make a LIST, and each list has ITEMS.

    each user has a userid
    each list has a listid

    I have the table set up as follows:

    I created a table called listitems which holds the userid and listid, but when displaying my information, it is not functioning 100% correct. i think im 90% to the solution.

    It is displaying an output as follows:


    LIST NAME
    ITEM NUMBER 1's ID
    ITEM NUMBER 2's ID

    but I cant get it to display the Name of the ID (the list item name)

    LIST NAME
    ITEM NAME
    ITEM NAME

    I have tried things like - <?php echo $rowListItems['itemid['Name']']; ?>

    But no luck,..im sort of new to this so any help would be appreciated..
    any ideas?

    Thank you!!
     
    timallard, Apr 23, 2009 IP
  2. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #2
    OK more progress, I added another search query call and now i can pull the correct ITEM name,..but it is looping the same one.

    i need to figure out how to get my syntax correct to pull in two query results... with parenthesis or brackets.. any ideas?

    Do i need to do something with foreign keys???? hmmm.
     
    timallard, Apr 23, 2009 IP