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 |
Final Prac - delete.php & student_course table. October 22, 2010 01:55PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 22, 2010 03:12PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 22, 2010 03:28PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 28, 2010 10:24PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 06:36AM |
Registered: 13 years ago Posts: 28 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 08:50AM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 10:59AM |
Registered: 14 years ago Posts: 58 Rating: 0 |
but when I check the student_course table through phpmyadmin, sno and cid return values of zero, and year is 2010.Language: PHPcase "Add" : switch ($_GET[';type';]) { case "course" : $sql = "INSERT INTO course (cname) VALUES (';" . $_POST[';cname';] . "';)" ; break ; case "student" : $sql = "INSERT INTO student (sname, init, fname, title, msname, dob, sex, lang, idno, telh, telw, cel, fax, email, address) VALUES (';" . $_POST[';sname';] . "';, ';" . $_POST[';init';] . "';, ';" . $_POST[';fname';] . "';, ';" . $_POST[';title';] . "';, ';" . $_POST[';msname';] . "';, ';" . $_POST[';dob';] . "';, ';" . $_POST[';sex';] . "';, ';" . $_POST[';lang';] . "';, ';" . $_POST[';idno';] . "';, ';" . $_POST[';telh';] . "';, ';" . $_POST[';telw';] . "';, ';" . $_POST[';cel';] . "';, ';" . $_POST[';fax';] . "';, ';" . $_POST[';email';] . "';, ';" . $_POST[';address';] . "';)" ; break; } break; } if (isset($sql) && !empty($sql)) { echo "<!--" . $sql . "-->" ; $result = mysql_query($sql) or die ("Invalid Query: " .mysql_error()) ; ?> <p align="center" style="color:#00FF00">Done.<br /> <a href="indexreg.php" class="button">Return to the Index Page.</a></p> <?php } ?> <?php $csquery = "INSERT INTO course_student (sno, cid, year) VALUES (';" . $_POST[';sno';] . "';, // also tried entering $sno, $cid here ';" . $_POST[';cid';] . "';, ';2010 ';)"; $result = mysql_query($csquery); $rows = mysql_affected_rows(); ?> <?php include "footer.php"; ?>
Re: Final Prac - delete.php & student_course table. October 29, 2010 01:20PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 02:50PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 04:40PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 29, 2010 05:06PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Language: PHP<?php $selected_course = $_POST[';cname';]; $sql = "SELECT cid FROM course WHERE cname = $selected_course"; $csquery = "INSERT INTO course_student (sno, cid, year) VALUES (';" . $_POST[';sno';] . "';, ';" . $_POST[';cid';] . "';, ';2010';)"; $result = mysql_query($csquery); $rows = mysql_affected_rows(); ?> <?php include "footer.php"; ?>
Re: Final Prac - delete.php & student_course table. October 29, 2010 05:52PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 30, 2010 09:22AM |
Registered: 13 years ago Posts: 28 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 30, 2010 01:17PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 31, 2010 04:22PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. October 31, 2010 07:53PM |
Registered: 13 years ago Posts: 28 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 10:17AM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 12:16PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHPinsert_author="INSERT INTO authors (name) VALUES (';$title';)"; mysql_query($insert_author) or die(mysql_error()); $authId = mysql_insert_id(); $query="INSERT INTO articles (body, date, category, auth_id) VALUES(';$body';, ';$date_now';, ';$category';, ';$authId';)"; //The build in function mysql_insert_id() retrieves the ID generated for an AUTO_INCREMENT column by the previous query //Be sure to call mysql_insert_id() immediately after a query to get the correct value.
Re: Final Prac - delete.php & student_course table. November 01, 2010 01:08PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Language: PHP<?php include "headeradmin.php" ; include "includes.php" ; switch ($_GET[';action';]) { case "Edit" : ... } ?> <html> <head> <title><?php echo $_GET[';action';]; ?> Student</title> <script> //... </script> <style type="text/css"> //{ CSS goes here } </style> </head> <body> <form action="commit.php?action=<?php echo $_GET[';action';]; ?>&type=student&sno=<?php echo $_GET[';sno';]; ?>" method="post" id="frm1"> <br /> <center><b>Student Registration Form</b> <br /> <br /> <b>Please provide the following information:</b></center> <br /> <br /> <table width="600" height="auto" border="1" cellspacing="0" cellpadding="3" align="center" bgcolor="#EEE"> <tr> <td>Course Name </td> <td><select name="cname" style="width:150px"> <?php $query = "SELECT * FROM course" ; $result = mysql_query($query) or die("Query Error" . mysql_error()); while ($row = mysql_fetch_array($result)) { echo ';<option name ="cid" value="'; . $row[';cid';] . ';">'; . $row[';cname';] . ';</option>'; . "\r\n" ; } ?> </select></td> //etc.. <td colspan="2" align="center"> <input name="SUBMIT" type="submit" value="<?php echo $_GET[';action';] ; ?>" /> <input type="button" onClick="formReset()" value="Reset form" /> <br /> </table> </form> <?php include "footer.php"; ?> </body> </html>
Language: PHP<?php include "headeradmin.php" ; include "includes.php" ; $selected_course = $_POST[';cname';]; //COMMIT ADD AND EDITS switch ($_GET[';action';]) { case "Edit" : switch ($_GET[';type';]) { case "student" : $sql = "UPDATE student SET .... case "Add" : switch ($_GET[';type';]) { case "course" : $sql = "INSERT INTO course (cname) VALUES (';" . $_POST[';cname';] . "';)" ; break ; case "student" : $sql = "INSERT INTO student (sname,...) VALUES (';" . $_POST[';sname';] . "';, ...)" ; break; } break; } if (isset($sql) && !empty($sql)) { echo "<!--" . $sql . "-->" ; $result = mysql_query($sql) or die ("Invalid Query: " .mysql_error()) ; ?> <p align="center" style="color:#00FF00">Done.<br /> <a href="indexreg.php" class="button">Return to the Index Page.</a></p> <?php } ?> <?php //$selected_course = $_POST[';cname';]; $sql1 = "SELECT cid FROM course WHERE cname = ';" . $selected_course . "';"; $result1 = mysql_query($sql1) ; $row = mysql_fetch_array($result1) ; $ccid = $row[';cid';] ; $csquery = "INSERT INTO course_student (sno, cid, year) VALUES (';" . $_POST[';sno';] . "';, ';$ccid';, ';2010';)"; $result = mysql_query($csquery); $rows = mysql_affected_rows(); ?> <?php include "footer.php"; ?> </body> </html>
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:09PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:36PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
to thisLanguage: PHPecho ';<option name ="cid" value="'; . $row[';cid';] . ';">'; . $row[';cname';] . ';</option>'; . "\r\n" ;
and I'm getting values in my cid fields.Language: PHPecho ';<option name ="cname" value="'; . $row[';cid';] . ';">'; . $row[';cname';] . ';</option>'; . "\r\n" ;
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:36PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:38PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:40PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:47PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 01, 2010 03:54PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 02, 2010 12:33PM |
Registered: 13 years ago Posts: 19 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 03, 2010 01:05PM |
Registered: 14 years ago Posts: 58 Rating: 0 |
Re: Final Prac - delete.php & student_course table. November 03, 2010 03:53PM |
Registered: 13 years ago Posts: 19 Rating: 0 |