Jump to content

query problem


squiblo

Recommended Posts

I have never attempted mysql like this before...this is what the table looks like..

 

||  user_id ||  other_person_id  ||  friend  ||  foe ||

        2                    44                      1          0

      34                      2                        1          0

 

 

What i want to do is this.... say that the $_SESSION['user_id'] == 2

 

and $user_id = $SESSION['user_id'];

 

Without doing 2 queries how can I pick put all the people that are friends with $user_id?

Link to comment
Share on other sites

forget that previous post, thats just be being stupid once again...i think i ment this...

 

mysql_query("SELECT * FROM table_name WHERE user_id='$user_id' OR page_zebra_id='$user_id' AND friend=1");

 

i have tried this but it only give me data from 1 row

Link to comment
Share on other sites

an easier way of putting it, how can i merge these 2 queries into 1...

 

mysql_query("SELECT * FROM table WHERE user_id='$user_id' AND friend=1");

 

and

 

mysql_query("SELECT * FROM table WHERE other_person_id='$user_id' AND friend=1");

 

 

and then my aim is to echo out the the row that doesnt have $user_id in it

 

 

NOTE: $user_id will never been the same in both rows

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.