I have these 3 tables:
fields
- id
- field
students
- id
- name
- birthday
- location
- ...
student_fields
- id
- student_id
- field_id
I would like to load from database all students according to a condition with all them fields from the table student_fields, but how to do that? Until now, I have a simple loading students:
//$s = "SELECT * FROM students JOIN WHERE name LIKE '%$search%'";
//$students = mysql_query($s);
EDIT: example: table fields contains:
id | field
1 | Citizenship
2 | Geography
3 | History
4 | Languages
5 | Literacy
6 | Music
7 | Numeracy
table student_fields for the respective students contains:
id | student_id | field_id
1 | 1 | 6
2 | 1 | 7
3 | 1 | 3
4 | 2 | 7
The goal: for the student with ID 1 I wanna print out his fiels, in this case Music, Numeracy, History.
Thank you guys