Jump to content

Recommended Posts

Hello,

 

I want to create and display school time table like post-168283-0-92792100-1400674966_thumb.jpg

 

I have created my database like this  

CREATE TABLE IF NOT EXISTS `time_table` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `class` varchar(20) NOT NULL,
  `section` varchar(10) NOT NULL,
  `subject` varchar(20) NOT NULL,
  `teacher` varchar(30) NOT NULL,
  `monday` varchar(10) NOT NULL,
  `tuesday` varchar(10) NOT NULL,
  `wednsday` varchar(10) NOT NULL,
  `thursday` varchar(10) NOT NULL,
  `friday` varchar(10) NOT NULL,
  `saturday` varchar(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Columns' Monday', 'Tuesday' will store starting hour of a period

 

But i don't know how to display it as above format. I even do not know whether i am using proper format of table. 

 

Somebody please suggest me how can i create this time table

 
Thanks
Edited by mythri

Do you understand simple HTML in order to create your table structure, if not, I would recommend learning this first before worrying about the PHP side of things.

 

If you do know how to create the table structure in HTML, what exactly is it that you want help with? Do you know how to query the database with PHP? 

Your db table design is more like a spreadsheet than a database table. You should also learn about "data normalization" so you can correctly design your db tables.

 

What is "section" in your data? Is it a section of a class?

The data model makes this assumption: section is part of a class containing a group of pupils who all take the same subjects and therefore have a common timetable schedule.

 

The principal table in the model is period which is a part of day where a subject is taught by a teacher to a section (group of pupils) in a room. This is the main table that will be queried to produce your timetable (with joins to the other tables to collect subject names, teacher names etc).

 

The advantage of such a model is that you can now do far more than just timetables EG

 

  • which pupils are in a class
  • which subjects does each pupil take
  • which pupils take a particular subject
  • which teachers teach a particular subject
  • which pupils does a teacher teach
  • when is room available
  • where is a pupil or teacher at a particular day/time
  • which are the most/least popular subjects
    • etc

post-3105-0-57220600-1400688773_thumb.png

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.