1
I have a system made in PHP and Mysql where I have two types of registration, teacher and student.
On this platform, the teacher can add a student as "friend" and the student can also add a teacher as "friend". In addition, the teacher can also add content in which ONLY STUDENTS WHO HAVE A RELATIONSHIP (added as a friend) WITH THIS TEACHER will be able to see when they are logged in.
To do this, I have the tables students and teachers, with their respective data, and I also have an N:N table called student teacher, which contains the student and teacher id (since the student may have several teachers added and the teacher may have several students added).
Also, I have a table called content, containing the teacher id that added this content. When logged in as a student, I need to get the CONTENTS that have been added by the teachers that have relationship with this student. How do I do this using table N:N?
Is your question about how to build an SQL query? Or do you use a ORM? What have you tried? Be more specific and if possible include the code of what you tried to do.
– GustavoAdolfo
It is an SQL query.
– Doougui