Assistance needed with mysql query to achieve this php5
| From: | Don Don | Date: | Thu, 24 Jan 2008 16:49:37 +0000 |
| Subject: | Assistance needed with mysql query to achieve this php5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-268011@lists.php.net to get a copy of this message | ||
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.