Welcome! Log In Create A New Profile

Advanced

list page :/

Posted by Johnny - 72985186 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar list page :/
May 01, 2011 08:34PM
How do I go about creating the list page and connecting the student and course tables so they both delete when deleting the course and all users registered for it? I have the page to display all the courses but I dont know how to connect these tables. Any help or a good source on the web would be great grinning smiley
avatar Re: list page :/
May 01, 2011 11:15PM
Nevermind realised the linking of tables where you delete a course and then all students with it was for the course_man page. But still same question smiling smiley
avatar
Mac
Re: list page :/
May 03, 2011 07:52AM
This was answered elsewhere I think? Which is why topics needs to have a good names...

Language: PHP
echo "$course <a href=whateverpage.php?delete=yes&course_id=cid>Delete course</a>"; // use the delete=yes if you make use of an if/else on the same page you are coding this e.g if(delete==';yes';) { delete}else{ show list}

Then on that page (or in the if part) you can run through the course_students table to find the rows with given cid.
delete all those rows and run a second delete deleting the course from the course table.
avatar Re: list page :/
May 04, 2011 10:56AM
Ah ok thanks Mac, so we will be using the course_student table for this and the list page?
avatar Re: list page :/
May 04, 2011 04:30PM
Nevermind got the list page sorted smiling smiley but do we have to use the course_student table for deleting on the course_man.php page?
Re: list page :/
May 04, 2011 05:19PM
I imagine yes you do need to use the course_student table when removing a course or a student for that matter.

You don't want to have a table with id's to non-existent entities as this would corrupt your data.

--

Student Number: 7298-786-3
avatar Re: list page :/
May 04, 2011 05:58PM
These tables linking together are becoming a pain haha. So every new student that registers and every new course added should have its sno and cid sent to the course_student table aswell and deleted when being deleted from the other tables?
Re: list page :/
May 04, 2011 06:06PM
Well every time a student registers for a course then an entry has to be added to the course_student table.

It is a separate table to give in a many-to-many relationship. 1 student can register for many courses, and one course can have many students.

When you delete from either the student table or the course table you need to check if there is an entry relating to the student or course in the course_student table. If there is you can either remove them or prevent the delete.

--

Student Number: 7298-786-3
avatar Re: list page :/
May 05, 2011 05:54PM
Ah damn I used the sno and cid from the student and course tables to connect them to each other for e.g the list page etc. Should I change that to using the course_student table? Also I don't see the part where we should allow students to sign up for more than 1 course, is that required or just added functionality that we can add for extra marks? And whats the year row for?
Re: list page :/
May 05, 2011 06:02PM
The course_student table is where the link is stored.

Allowing a student to register for multiple courses at the same time is listed as below under the additional functionality section, so is optional
Quote

allow a user to register for more than one course at the same time.

The year is there as an additional field. I am not sure exactly what it is meant for. I use it as the year f registration and populate it with date('Y'winking smiley; which gives the current year. That way when I send out emails or display the number of students on the course I only need look at the most current year. I also have some data mining pages to give numbers of students over the years.

--

Student Number: 7298-786-3
Sorry, only registered users may post in this forum.

Click here to login