I have two tables a user table and a friend table. The following query looks up the friend value and compares the friend_id to the user_id in the user table to obtain the FName of a friend. That query is:
$query = "SELECT f.FName"
." FROM friends AS fu"
." LEFT JOIN users AS u ON u.user_id=fu.user_id"
." LEFT JOIN users AS f ON f.user_id=fu.friend_id"
." WHERE u.user_name='".mysql_escape_string($_SESSION[Username])."' AND fu.confirm='Y' ORDER BY fu.date DESC LIMIT 0, 3 ";
I also have a pic column in the user table. I thought I could just subsitute the f.FName for f.pic but it doesn't seem to work. The query is:
$query = "SELECT f.pic"
." FROM friends AS fu"
." LEFT JOIN users AS u ON u.user_id=fu.user_id"
." LEFT JOIN users AS f ON f.user_id=fu.friend_id"
." WHERE u.user_name='".mysql_escape_string($_SESSION[Username])."' AND fu.confirm='Y' ORDER BY fu.date DESC LIMIT 0, 3 ";
I can't get it to grab the pics though...can anyone please help.
Thanks in advance!