Results 1 to 4 of 4

Thread: Querying two tables help

  1. #1
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Querying two tables help

    Hey all...new here.

    I"ve struggled with this for hours now. I always try and find the answers before I post, so I hope someone can help me.

    I'm trying to pull four fields from two different tables in my database. I"m working on a feature that allows people to post in other members areas.

    the outline would be:

    Posted by "username"...."date created"....."comment"

    I have two tables that hold this information. I think that I have to use the user id from table one that holds the actual users ID and make it equal to the other table that holds the userID that posted the comment. That way the two ID's will match in the output.

    So I have two tables... one for members....and one for posts...

    members table holds:
    1. user_id
    Code:
    posts table holds:
    1.  user_id
    2.  post_id
    3.  date_created
    Now how in the world would I call all of this out of the database in one query? LOL. If I can do that, then I should be able to just <?php echo everything where I want it.

    Thanks for any help and direction.

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,742
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Would you be able to reword and further organize your last post? The table formats you have are helpful, but seem to be lacking. For example:

    1. The members table has only one column? That seems rather unusual to me.
    2. What table has the column for the posts?
    3. What table has the column for the users names?

    Post that information and I think I can help you.
    To choose the lesser of two evils is still to choose evil. My personal site

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,742
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Actually, I think I have all of the information I need. When I get home tonight I'll try to post something.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,742
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Sorry, but the more I look at your post the less I understand. I really need you to rephrase and clarify what it is that you want. Please address my earlier questions as well as this sentence:

    I"m working on a feature that allows people to post in other members areas.
    To choose the lesser of two evils is still to choose evil. My personal site

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
  •