But for the teacher to be able to insert marks into the database he/she needs to login and when He/she logs into the system he/she will find a list of students he/she teaches and the subjects he/she is teaching and the subjects he/she is teaching to those students.
I have this MySQL query, that retrieves the records from the database. Here is the problem; Teacher A who teaches subject X logs in and inserts marks for student Z, and after inserting the marks then logs out.Then Teacher B who teaches subject Y logs into the system, teacher B will find marks inserted by Teacher A on Subject Y even though, teacher B has not yet entered the marks.
Here is the MySQL code;
[code] SELECT marks.test_1,
students.id,
students.student_id,
students.student_name,
subjects.subject_name,
forms.form_name,
teacherxsubject.form_id,
students.class,
teacherxsubject.subject_id,
teacherxsubject.teacher_id
FROM
`students`
LEFT JOIN
teacherxsubject ON students.class = teacherxsubject.form_id
LEFT JOIN
marks ON students.student_id = marks.student_id
LEFT JOIN
subjects ON subjects.subject_id = teacherxsubject.subject_id
LEFT JOIN
forms ON forms.form_id = teacherxsubject.form_id
WHERE teacherxsubject.teacher_id=192[/code]