Hi Im new to MySQL and PHP, and this is my first post.. So please bear with me.
I am trying to add two tables and two rows from one table
friends
member_ID | friend_ID | status
and a user
table
member_ID | username
What I am trying to do is combine both tables for a friend request, friends.member_ID
is the user.member_ID
sending the request, friends.member_ID
, is the user.member_ID
that is being requested, status
is when they accept the request it will turn 0
to 1
which will make the relationship true.
so far, I have this for my query to display all these fields to show who has requested this person as a friend
SELECT users.member_ID, friends.member_ID, friends.friend_ID, friends.status
FROM `users` , `friends`
WHERE friends.status=0
AND users.member_ID = friends.member_ID
AND friends.member_ID = users.member_ID
AND users.member_ID = 6 (this will be $_SESSION[member_ID] when I add it to php)
I understand you can use an alias but I am a bit confused
Please help, my assignment is due tomorrow, and there is still so much to do.
Thanks