Assistance needed with mysql query to achieve this php5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all I have a table below

CREATE TABLE `friends` (
  `id` int(11) NOT NULL auto_increment,
  `member_id` int(11) NOT NULL,
  `member` varchar(32) NOT NULL,
  `friendwith` varchar(32) NOT NULL,
  `friendWithId` int(11) NOT NULL,
  `status` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ;


I run the following query to get my friends

SELECT fc.friendWithId, fc.friendWith, uu.image_path, uu.first_name, uu.last_name, uu.city, uu.gender, uu.relationship_status, uu.last_login FROM friends fc JOIN users uu ON fc.friendWithId = uu.user_id WHERE member_id = '%s' AND member = '%s' and fc.status='active'

I need help on how to modify the sql query so that it not only displays people who am friends with but  should also display people who are friends with me

What i currently have is a one way relationship, I am trying to modify the query to create a two way relationship.

Cheers

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux