I want to make a group profile where user can view the members of any group who has joined that group. but problem is that When I am using my query it is not working correct it is showing who also have the request to join but not accepted that group and I want to show only who have joined the group. Here is the query:
$grprqstprofile=mysqli_query($connect,
"select UserLogin.User_No, UserLogin.Fist_Name,
UserLogin.Last_Name, UserLogin.Profile,
UserLogin.Designation, UserLogin.ProfileDP,
GroupRqst.grprqst_SNo, GroupRqst.Group_Id,
GroupRqst.Group_Admin, GroupRqst.Grouprqst_Receiver,
GroupRqst.Grouprqst_Sender, GroupRqst.Group_Status
FROM UserLogin
INNER JOIN GroupRqst ON UserLogin.User_No = GroupRqst.Grouprqst_Receiver
WHERE Grouprqst_Receiver='$user_id'
AND Group_Id='$grpviewerid'
AND Group_Status='1'");
UserLogin
is the table containing the information who has their ID with this site.
GroupRqst
is the table containing the information with group's member request.
$grpviewerid
is getting the Grou_Id from another page using get function { @$grpviewerid = $_GET['gid']; }
.
Please help me to solve this issue.
I guess in the where statement you should try absolute table names like this
WHERE GroupRqst.Grouprqst_Receiver='$user_id'
AND GroupRqst.Group_Id='$grpviewerid'
AND GroupRqst.Group_Status='1'
Source: Own experience