I am trying to create a system where depending on what user is a)logged in or b)if the username is found in the array.
If you are logged in and in the friend_array of the person, you should see the 'Unfriend' button. If you're on the page which is your own profile, everything is hidden If your not on your page and not in the array, 'Add Friend'.
The statement for the 'Add Friend' must be reading my statement incorrectly, as I only want it to appear when your not in the array and when the _Session username is not equal to the username selected by getting the id.
$cool = $_GET['id'];
$evan = mysql_query("SELECT * FROM users WHERE username='{$_SESSION['user_login']}'");
$joe1 = mysql_fetch_assoc($evan);
$cookie = mysql_query("SELECT * FROM users WHERE id='{$_GET['id']}'");
$joe = mysql_fetch_assoc($cookie);
$i = 0;
$berbs = $joe['username'];
error_reporting(E_ERROR | E_PARSE);
if (in_array($_SESSION['user_login'], $friendArray)) {
$addAsFriend = '<input type="submit" name="removefriend" value="UnFriend">';
echo $addAsFriend;
}
error_reporting(E_ERROR | E_PARSE);
if ($_GET['id'] == $joe1['id']) {
$addAsFriend = '<input style="display:none;" type="submit" name="addfriend" value="Add Frimm1end">';
echo $addAsFriend;
}
error_reporting(E_ERROR | E_PARSE);
if (!in_array($joe1['username'], $friendArray) || $_GET['id'] != $joe1['id']) {
$addAsFriend = '<input type="submit" name="addfriend" value="Add Friend">';
echo $addAsFriend;
}