When a user sends a friend request and accepts it the friends info and pic are displayed perfectly on the users side but on the friends side the friends own pic and info is displayed instead of the user who friended the friend how can I fix this problem?
users friends table
CREATE TABLE users_friends (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT UNSIGNED UNSIGNED NOT NULL,
friend_id INT UNSIGNED NOT NULL,
friendship_status TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
date_created DATETIME NOT NULL,
PRIMARY KEY (id),
KEY user_id (user_id),
KEY friend_id (friend_id)
);
My current MySQL code
SELECT users.*,
users_friends.*
FROM users
JOIN users_friends ON users.user_id = users_friends.friend_id
WHERE ( users_friends.user_id = '" . $user_id . "'
OR users_friends.friend_id = '" . $user_id . "')
AND users_friends.friendship_status = 1
GROUP BY users_friends.date_created