Re: Assistance needed with mysql query to achieve this php5

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

 



Hi Richard, I'll try out your suggestions and will let you know if i had any luck.
The db structure is a little complicated hence the duplication of usernames.
Cheers

Richard Lynch <ceo@xxxxxxxxx> wrote: Just take out member_id = '%s' and use friendWIthId = '%s' instead.

Actually, I think you may need to swap member/friendwith as well...

But why you are storing everybody's NAME twice is beyond me...

Or maybe I'm guessing wrongly what the fields are...

On Thu, January 24, 2008 10:49 am, Don Don wrote:
> 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.


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?



       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

[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