mysql query for show all friendnames in home page?
<p>when a user will log in his profile then he will c all of his friends in his home page,I have 2 tables,no1:-table name fsb_profile containing profile_id,profile_name,etc table no2:- fsb_friendlist containing friendlist_memberid,friendlist_friendid.now i want to show the friend details in home page,</p>

<p><strong>my code is:-</strong></p>

<pre><code>$id=$_SESSION["_ID"];
$query = "select * from fsb_profile " .
    "where fsb_profile.profile_id=(" .
    "select fsb_friendlist.friendlist_friendid " .
    "from fsb_friendlist " .
    "where friendlist_memberid=" . $id . ")";

if( $sql = mysql_query($query) ) {
    while ($t = mysql_fetch_assoc($sql)) {
        echo "hai";
        echo $t["profile_name"];
    }
} else {
    echo "Something went horribly wrong.\n";
}
**error:-**Something went horribly wrong.
</code></pre>
