I first need to search the friends table for ALL matches where global_id matches the global id in the address, then I need to grab friend_global_id from those matching fields. Then i need to get the information from TABLE profile_photo in FIELD profile_photo_url that matches the friend_global_id looked up in the friends table, then lastly i need to get from the TABLE loginphp FIELDS Fname and Lname that have the global_id that matches up with the friend_global_id from the friends table.
Heres my query (doesnt work), how would I fix it:
Code: Select all
$query = "SELECT
friends.global_id, friends.friend_id, profile_photo.global_id, profile_photo.profile_photo_url, loginphp.global_id, loginphp.Fname, loginphp.Lname
FROM
friends, profile_photo
JOIN
loginphp
ON
friends.friend_id=loginphp.global_id
WHERE
friends.global_id='". mysql_real_escape_string($_GET[id]) . "'";steve