Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7088709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:50:02+00:00 2026-05-28T07:50:02+00:00

I would love to get some help with this. I’m using php and MySQL

  • 0

I would love to get some help with this. I’m using php and MySQL to build a website. I currently have 3 tables, I’ll include less in the examples. Basically I have a users table, a groups table and a grouplink table. What I have is the uid from the users table.

How should I go about it in php so I could, let’s say: match users-uid to grouplink-uid, get the grouplink-gid it matches with, match grouplink-gid to groups-gid and return groups-grpname? And goes on a while loop so all group names the user is associated with are displayed.

Thanks in advance to those who will be willing to extend a hand.

users

-------
| uid |
-------
|  1  |
-------  

groups

---------------
| gid |grpname|
---------------
|  1  | grp1  |
---------------
|  2  | grp2  |
---------------

grouplink

-------------------
| glid| uid | gid |
-------------------
|  1  |  1  |  1  |
-------------------
|  2  |  1  |  2  |
-------------------

uid is fk to uid in users while gid is fk to gid in groups

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:50:03+00:00Added an answer on May 28, 2026 at 7:50 am

    That’s just a simple 2-way join query:

    SELECT users.uid, groups.gid, groups.grpname
    FROM users
    INNER JOIN grouplink ON users.uid = grouplink.uid
    INNER JOIN groups ON grouplink.gid = groups.gid
    

    the actual retrieval of a joined query result is no different than a single table query – you’ve just got more fields to deal with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would love to get some tips from other people that have had this
Ok here's a little problem I would love to get some help on. I
Some newbie questions. First, I would love to get this plugin: http://archive.plugins.jquery.com/project/getAttributes but I
So I'm very beginner with javascript and would love some help simplifying this code.
We're about to build a Blackberry application but would love some input on whether
I'm currently working on my own PHP Framework, and I need some help figuring
Looking for some help and advice please from Super Guru MySQL/PHP pros who can
I'm just starting to figure out regex and would love some help trying to
any help with this would be great. I have a model public class Master
Hey everyone I am a newbie and would love some help. I got the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.