How to organize both times, for example (10:00-12:00) and days together?

A teacher (tutor) is registered, he has the ability to add students (name, number, school, class time, what days he comes, etc.).
After entering the site, it is necessary that his personal page opens something like this:

  : 
    1  (10:00-12:00)
    
     
    
    2  (13:00-15:00)
    
    
     ..

Here’s the problem is that I don’t understand how to organize both times, for example (10:00-12:00) and days together. I did it like this:

           $day[0] = ""; 
            $day[1] = ""; 
            $day[2] = ""; 
            $day[3] = ""; 
            $day[4] = ""; 
            $day[5] = ""; 
            $day[6] = ""; 
           $dnum = date("w"); 
           $textday = $day[$dnum];
            echo ":  $textday";
            $result = mysql_query("SELECT id,name FROM students WHERE day='$textday'",$db);
            $myrow = mysql_fetch_array($result);
    do {
    printf ("<p><a href='students_view.php?id=%s'>%s</a>",$myrow["id"], $myrow["name"]);
    }
    while ($myrow = mysql_fetch_array($result));
    ?> 

This displays, for example, who is today on Friday. But what about with time?

Another question about teacher registration. After all, each teacher will have his own list of students. Do I need to create a new table in the database for each teacher?

And one last question, how can you organize student attendance?


Answer 1, authority 100%

In the database, enter the time in minutes from the beginning of the day, i.e. if the beginning of the interval is 10:00, then multiply 10 by 60 in the database, and the same with the end of the interval – 12 times 60. Next, we will find out the time at the moment using the same date() function. For example, it’s 10:24, do this: $t = 10*60+24. Then the query will look like this:

$result = mysql_query("SELECT id,name FROM students WHERE startspan<=$t and endspan>=$t,$db);

Attendance of students for tutoring can be organized only by the fact that the tutor will keep an online journal on your service.


Answer 2, authority 100%

Another question about registration
teachers. After all, every teacher will
your list of students. Need for
each teacher to create a new
table in the database?

start 2 (minimum) tables of teachers and students,
in the teacher’s room, enter the teacher’s id and his data,
to the student’s student id, data and id of his teacher,
all – add a filtering condition to the student data selection condition
by teacher id (SELECT * FROM students WHERE teacher_id = 7)
and see only his students.