"SELECT * FROM admin inner join student on admin.iddep=student.iddep where admin.UserName='$name' and student.iddep='$iddep' and student.groups='$groups' and student.room='$room' ORDER BY id ASC"
SELECT * FROM admin inner join student on admin.iddep=student.iddep INNER JOIN ON dep ON admin.dep=dep.dep where admin.UserName='$name' and student.iddep='$iddep' and student.groups='$groups' and student.room='$room' ORDER BY id ASC"