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 |
Deleting rows form student table April 23, 2011 02:43PM |
Registered: 13 years ago Posts: 85 Rating: 0 |
Language: PHP<?php include ';includes/config.php';; $delete_sql ="SELECT sno,cname, sname FROM student ORDER BY sno DESC"; $delete_query = mysql_query($delete_sql) or die(mysql_error()); $rsDelete = mysql_fetch_assoc($delete_query); ?> <html> <head> </head> <body> <p> select student to delete </p> <?php do { ?> <p><a href="delstudentcomfirm.php?sno=<?php echo $rsDelete[';sno';]; ?>"> <?php echo $rsDelete[';cname';]; ?> by <?php echo $rsDelete[';fname';]; ?> </a> </p> <?php } while ($rsDelete = mysql_fetch_assoc($delete_query)) ?> </body> </html>
Re: Deleting rows form student table April 23, 2011 03:16PM |
Registered: 13 years ago Posts: 85 Rating: 0 |
Language: PHP<?php include ';includes/config.php';; session_start(); $_SESSION[';deletestudent';][';sno';] = $_GET[';sno';]; $confirm_sql = "SELECT * FROM student WHERE sno=';".$_GET[';sno';]."'; "; $confirm_query = mysql_query($confirm_sql); $rsconfirm = mysql_fetch_assoc($confirm_query); ?> <html> <head> </head> <body> <p> confirm student to delete</p> <p> <?php echo $rsConfirm[';cname';]; ?> </p> <p> <?php echo $rsConfirm[';sname';]; ?> </p> <p> <?php echo $rsConfirm[';fname';];?> </p> <p><a href="selectdelstudent.php"> Oops, made a mistake</a></p> <p><a href="studentdeentdelete.php"> Delete this student</a></p> </body> </html>
Language: PHP<?php include ';includes/config.php';; session_start(); $delete_sql = "DELETE FROM student WHERE sno = ';".$_SESSION[';deletestudent';][';sno';]."';"; $delete_query = mysql_query($delete_sql); unset($_SESSION[';deletestudent';]); ?> <html> <body> <p> Student has been deleted </p> </body> </html>
Re: Deleting rows form student table April 23, 2011 03:50PM |
Registered: 13 years ago Posts: 60 Rating: 0 |
Re: Deleting rows form student table April 23, 2011 03:52PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Deleting rows form student table April 23, 2011 04:10PM |
Registered: 13 years ago Posts: 85 Rating: 0 |
Language: PHP<?PHP define(';DB_NAME';, ';registration';); define(';DB_USER';, ';root';); define(';DB_PASSWORD';,';';); define(';DB_HOST';, ';localhost';); ?>
Re: Deleting rows form student table April 23, 2011 04:13PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Deleting rows form student table April 23, 2011 04:23PM |
Registered: 13 years ago Posts: 85 Rating: 0 |
Language: PHP<?php include ';includes/config.php';; //connect to database $link=mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); //error check if (!$link) { die(';could not connect: '; . mysql_error()); } $db_selected=mysql_select_db(DB_NAME, $link); // error check if (!$db_selected) { die(';can\t use '; . DB_NAME . ';: '; . mysql_error()); } // Connected to database $delete_sql ="SELECT sno,cname, sname FROM student ORDER BY sno DESC"; $delete_query = mysql_query($delete_sql) or die(mysql_error()); $rsDelete = mysql_fetch_assoc($delete_query); ?> <html> <head> </head> <body> <p> select student to delete </p> <?php do { ?> <p><a href="delstudentcomfirm.php?sno=<?php echo $rsDelete[';sno';]; ?>"> <?php echo $rsDelete[';cname';]; ?> by <?php echo $rsDelete[';fname';]; ?> </a> </p> <?php } while ($rsDelete = mysql_fetch_assoc($delete_query)) ?> </body> </html>
Re: Deleting rows form student table April 23, 2011 04:31PM |
Registered: 13 years ago Posts: 85 Rating: 0 |
Re: Deleting rows form student table April 23, 2011 04:54PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Deleting rows form student table April 24, 2011 02:40AM |
Registered: 13 years ago Posts: 85 Rating: 0 |