I have two tables the group_table where all the groups information is stored.
And i have a group_person_table where all id's which correlate to groups
I only want to display the group information to multiple users if they match in group_person_table
the database looks like this :
Group_table person_id, group_id, groupname, groupdesc.
Group_person_table person_group_id, group_id, person_id
currently i only have the following query:
"SELECT * FROM group_table WHERE person_id = $person_id" IN (SELECT person_id FROM group_person_table WHERE person_id =$person_id);
I currently am able to display all of the groups to all of the users but i only want to display the groups to the users if they're the same in group_person_table so user A and B are in group A so they both see Group A, if user A is in Group B, then User B wont see group B!
I'm displaying calling upon the data in OOP
public function get_project($person_id){ //$sql3="SELECT * FROM group_table WHERE person_id = $person_id "; $sql3="SELECT * FROM group_table WHERE person_id = $person_id"; $results = mysqli_query($this->db, $sql3);
Aucun commentaire:
Enregistrer un commentaire