Viewing file: del.php (791 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $servername = "localhost"; $username = "ailwssor_user"; $password = "rb!ail838"; $dbname = "ailwssor_database"; $id=$_POST[q]; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$field = 'serialno'; $sql = "DELETE FROM student_admission WHERE $field like \"$id\" ";
// use exec() because no results are returned $conn->exec($sql); echo "Record deleted successfully"; } catch(PDOException $e) { echo $sql . "<br>" . $e->getMessage(); }
$conn = null; header("location: homepage.php"); ?> <script type="text/javascript"> window.location.href = "homepage.php" </script>
|