Jump to content

INNER JOIN Help


stewart715

Recommended Posts

I can't seem to figure this out whatsoever! Any help will be much appreciated. To explain best, I'll show you the database tables I have

for example purposes lets say $user->uid is 2

TABLE: buddylist
[b]uid  buddy  received[/b]
2      7          1
3      5          1
2      8          0
2      3          1

TABLE: users
[b]uid  name[/b]
2    mike
7      joe
3    john
8      bill

i need a code that will select buddy from buddylist where $user->uid = uid and receieved = 1 and then check users where the outputted buddy number = uid (in users) then to output the name..

so joe and john should come out..it will see that $user->uid (2) has 7 and 3 next to it in buddy where recieved is 1...then it will find that persons name by comparing 7 and 3  to uid in users and then ouput joe and john..im guessing its an innerjoin? Thanks for ANY help!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.