more issues with following and unfollowing!
This time there is supposed to be a check to the database of if i'm following a user or not. If I am, its supposed to display "Unfollow", if i'm not its supposed to display "follow"
I have a user_follow table that contains the ID of the follower and the user followed, under the names "follower" and "user"
The code to get these:
$check_following = mysql_query("SELECT `follower`, `user` FROM user_follow WHERE `user`=$p_id'");
$follow_query = mysql_fetch_array($check_following);
p_id is the profile i'm looking at. The if statement:
if(isset($_SESSION['id']) && $p_id != $_SESSION['id'])
{
if ($follow_query['follower'] == $_SESSION['id'] && $follow_query['user'] ==$p_id)
{
echo 'Unfollow';
}
else {
echo 'Follow';
}
}
Problem is, unfollow shows on 1 out of the 3 profiles i'm following, and follow shows on 2 profiles i'm following, echoing $follow_query['follower']
shows 1, which isn't me (also shows 1 for another user)
Any ideas?
Thanks guys