<?
//FRIENDS PAGE
if (!$link = mysql_connect('--', '--', '--')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('modelsite', $link)) {
echo 'Could not select database';
exit;
}
$sql = "SELECT * FROM friend_requests WHERE recipient = 'jason' and approved = 'Yes' OR sender = 'jason' and approved = 'Yes' ORDER BY id DESC";
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
//removes self from friends list
if ( $row['recipient'] == "jason" ) echo NULL; else $recfiltered = $row['recipient'];
if ( $row['sender'] == "jason" ) echo NULL; else $senfiltered = $row['sender'];
}
mysql_free_result($result);
?>
<?
//GET THEIR PROFILE INFO OF OUTPUT USERNAMES
if (!$link = mysql_connect('---', '--', '--')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('modelsite', $link)) {
echo 'Could not select database';
exit;
}
$sql = "SELECT * FROM members WHERE username = '$recfiltered'";
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $username=$row['username'];
}
mysql_free_result($result);
?>