Jump to content

Querying a second table based on 1st queries results


mattichu

Recommended Posts

hi  :D

 

I have 2 tables (members & friendship)

 

 

 

Members table columns:

--------------------------------------------

username | password |    email    | etc ....

--------------------------------------------

Person 1    xxxxxx        [email protected]

person 2    yyyyyy        [email protected]

 

Friendship columns:

 

---------------------------------------

username |  friend  |  status  |

---------------------------------------

person 1    person 2    friends

person 2    person 1    friends

person 1    person 3    pending

 

 

 

I want to query the friendship table: "SELECT friend FROM friendship WHERE username ='$_SESSION['myusername'];'  AND status='friends' "

 

(so its basically getting the user names of anyone who is the logged in users friend)

 

And then use the returned user names  to select their data from the members table.

 

Any help much appreciated!

 

^.^

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.