mythri Posted May 21, 2014 Share Posted May 21, 2014 (edited) Hello, I want to create and display school time table like 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 May 21, 2014 by mythri Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/ Share on other sites More sharing options...
IanA Posted May 21, 2014 Share Posted May 21, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480296 Share on other sites More sharing options...
Barand Posted May 21, 2014 Share Posted May 21, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480299 Share on other sites More sharing options...
mythri Posted May 21, 2014 Author Share Posted May 21, 2014 yes , it is section of class Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480303 Share on other sites More sharing options...
Barand Posted May 21, 2014 Share Posted May 21, 2014 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 subjectsetc Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480327 Share on other sites More sharing options...
mythri Posted May 26, 2014 Author Share Posted May 26, 2014 @Barand: Sorry for delay in reply. Thanks a lot for the detailed data model. I will follow the same structure and try. If i stuck anywhere i will need your help again. Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480848 Share on other sites More sharing options...
Barand Posted May 26, 2014 Share Posted May 26, 2014 Wasn't sure if going to take my advice. In that case, to get you started, here is an SQL script file to create the tables and some test data for you mythri.sql.txt Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480886 Share on other sites More sharing options...
mythri Posted May 27, 2014 Author Share Posted May 27, 2014 Thank you once again. Yes, i am following the data model sent by you. Quote Link to comment https://forums.phpfreaks.com/topic/288650-creating-and-displaying-school-timetable/#findComment-1480986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.