I need to create a table to store users’ class schedules. These schedules have 7 blocks a day for Monday through Friday. However, not all blocks are filled with classes.
I was planning on creating a table that stored stored a user’s id, the period id, the class name, and the class subject in each record. If I implement it this way, what is the best way to determine when a user does not have classes using PHP? Is there a better layout for this?
You need to make three tables, and set up a many-to-many relationship.
But if you don’t want to get real complex, why not just insert the students free time like a class, call it ‘free time’, then you can just search for those.
SELECT * FROM records WHERE student_id = ‘0001’ AND class = ‘free time’
Otherwise, I’m not sure how you’d find an empty block without having a table devoted to the blocks.