mySQL query result from multiple tables to PHP
Posted by:
stodge
Date: February 16, 2006 07:17PM
I have three tables in my mySQL database:
user - user_group, group
user (defines user accounts)
user_id
username
group (defines groups)
group_id
group_name
group_description
user_groups (defines which groups users belong to, one user to many groups):
user_id
group_id
Is there any way using joins to retrieve the following result as single query:
user_id = 1
username = mike
group_name = array(admin, user)
I need to take the result of this single query and populate a PHP object. I don't see how this is possible. So far the best I can do is to retrieve two records the same, but with different group names:
user_id = 1
username = mike
group_name = admin
user_id = 1
username = mike
group_name = user
Any suggestions appreciated. Thanks
Subject
Written By
Posted
mySQL query result from multiple tables to PHP
February 16, 2006 07:17PM
February 17, 2006 01:14AM
February 17, 2006 07:08AM
February 17, 2006 08:40AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.