I am trying to figure out how I can query two different tables to get a count (?) variable.
Table 1
ID | ip_address | user_id
Table 2
unique_id | user_id | friend | other_variables
I need to query and find all (multiple lines) in Table 2 where user_id = '$user_id'
Then query Table 1 to find if user_id = $friend
I need to get one variables back.
1: How many lines (times) was $friend found in Table 1
Table 1 is updated all the time (users online type thing)
What I have is a 'Friends' list that it needs to see if my friends are online and if so, how many?
Any help and/or coding would be greatly appreciated.
Thanks