Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Re: Practical September 10, 2010 07:14AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: SQLCREATE TABLE IF NOT EXISTS `course` ( `cname` VARCHAR(50) NOT NULL DEFAULT ';';, `cid` INT(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`cid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; -- -------------------------------------------------------- -- -- Table structure for table `course_student` -- CREATE TABLE IF NOT EXISTS `course_student` ( `sno` INT(6) NOT NULL DEFAULT ';0';, `cid` INT(6) NOT NULL DEFAULT ';0';, `year` INT(4) NOT NULL DEFAULT ';0'; ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE IF NOT EXISTS `student` ( `sno` INT(6) NOT NULL AUTO_INCREMENT, `sname` VARCHAR(40) NOT NULL DEFAULT ';';, `init` VARCHAR(5) NOT NULL DEFAULT ';';, `fname` VARCHAR(40) NOT NULL DEFAULT ';';, `title` VARCHAR(4) NOT NULL DEFAULT ';';, `msname` VARCHAR(40) NOT NULL DEFAULT ';';, `dob` VARCHAR(8) NOT NULL DEFAULT ';';, `sex` CHAR(2) NOT NULL DEFAULT ';';, `lang` VARCHAR(10) NOT NULL DEFAULT ';';, `idno` VARCHAR(13) NOT NULL DEFAULT ';';, `telh` VARCHAR(12) NOT NULL DEFAULT ';';, `telw` VARCHAR(12) NOT NULL DEFAULT ';';, `cel` VARCHAR(12) NOT NULL DEFAULT ';';, `fax` VARCHAR(12) NOT NULL DEFAULT ';';, `email` VARCHAR(40) NOT NULL DEFAULT ';';, `address` tinytext NOT NULL, PRIMARY KEY (`sno`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
Re: Practical September 10, 2010 07:20AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical September 10, 2010 07:24AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical September 10, 2010 03:00PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Language: SQLGRANT ALL ON registration.* TO lizwe@localhost IDENTIFIED BY ';';;
Language: PHP<?php $title = "Course Manager"; //getting the value of "course_name" variable from the add_course.html page $course_name = $_GET[';course_name';]; //connecting to the database $link_id = mysql_connect("localhost", "lizwe", ""); //testing connection if ($link_id) echo "Success in connecting!"; else echo "Failed to connect."; //inserting value of "course_name" variable into the table "course" mysql_select_db("registration"); $query = "INSERT INTO course VALUES (';$course_name';)"; $result = mysql_query($query); //to test if the record was added to the database $rows = mysql_affected_rows(); if ($rows < 1) echo "Error. The record has not been added."; else "$rows record has been added"; ?>
Re: Practical September 13, 2010 07:50AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical September 13, 2010 04:37PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Re: Practical September 13, 2010 07:59PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
the first empty ' ' will tell mysql to add the record ($course_name) and give it the next course_idLanguage: PHPINSERT INTO course VALUES (';';, ';$course_name';)";
Re: Practical September 14, 2010 02:15PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Re: Practical September 14, 2010 03:58PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Language: HTML<input name=';option'; TYPE=';hidden'; value=';add';>
Language: PHP//Checking to see if the request came from adding, deleting or editing the course_name $option = $_GET[';option';]; //selecting appropriate action to take based on the value of "option" variable switch ($option) { case "add" : //getting the value of "course_name" variable from the add_course.html page $course_name = $_GET[';course_name';]; //inserting value of "course_name" variable into the table "course" mysql_select_db("registration"); $query = "INSERT INTO course VALUES (';$course_name';, ';';)"; $result = mysql_query($query); //to test if the record was added to the database $rows = mysql_affected_rows(); if ($rows < 1) echo "Error. The record has not been added."; else echo "$rows record has been added"; break; }
Re: Practical September 15, 2010 07:26AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical September 16, 2010 04:40PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Re: Practical September 17, 2010 08:51AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Question - Student Registration Page and Form September 20, 2010 09:03PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Practical September 21, 2010 06:56AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical September 29, 2010 04:02PM |
Registered: 13 years ago Posts: 64 Rating: 0 |
Re: Practical September 29, 2010 09:17PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical October 05, 2010 11:39AM |
Registered: 14 years ago Posts: 34 Rating: 0 |
Re: Practical October 05, 2010 02:06PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Practical November 02, 2010 07:03PM |
Registered: 13 years ago Posts: 19 Rating: 0 |
Re: Practical November 03, 2010 06:44AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |