Re: Assistance needed with mysql query to achieve this php5

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

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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