Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008

    Unanswered: Query needed which must works in PHP

    I am working with PHP5 and mysql.
    I am having 3 tables in database, as shown in image.
    So i want to display the avatar and name of the friends for the current user.
    1. So when i query for the user 11 means, it must see the friendid of the user 11 from friends table which are 12 and 13.
    2. Next that 12 and 13 must be looked up on users table for username being the friendid of friend table is equal to id of users table
    3. Finally, for that 12 and 13 avatarid and avatarext must be looked from avatar table.

    I tried this which displays only avatarid for the queried user, but i know how to join the other table.
    Any ideas?
                                           SELECT avatarext,avatarid
    					FROM avatar
    					WHERE userid IN(
    					SELECT friendid
    					FROM friend
    					WHERE userid='11';

  2. #2
    Join Date
    Nov 2008
    Moderator: Please delete this thread, this is a duplicate thread. Thankyou

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts