<?php require_once("PasswordMstr.php"); ?>

<!DOCTYPE html PUBLIC

"-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Delete a Person</title>

<link rel="stylesheet" href="php_styles.css" type="text/css" />

</head>

<body>

<h3>Deletion of a Person / Record</h3>

<?php

$PersonID = $_GET['DelPersonID'];

 

if (empty($PersonID))

                exit("<p>You must enter Name id. Click back.</p>");

               

// $DBConnect = @mysqli_connect("localhost", "root")                                                                                 // (Test)  Connect to MySQL                

$DBConnect = mysqli_connect("db1234.abcdefg.net", "db1234567890", "abcdefgh", "db1234567890")   // Connect to MySQL

                Or die("<p>Unable to connect to data base server 1.</p>"

                . "<p>Error code " . mysqli_connect_errno()

                . "; " . mysqli_connect_error()) . "</p>";

               

// $DBName = "AddressBook";                 

$DBName = "db240712012";                                                                                                      

mysqli_select_db($DBConnect, $DBName)                                                                                                         // Select Data base

                Or die("<p>Unable to select the data base.</p>"

                                . "<p>Error code " . mysqli_errno($DBConnect)

                                . "; " . mysqli_error($DBConnect)) . "</p>";

 

$TableName = "persons";                                                                                                                                                                            // Read the Table

$SQLstring = "SELECT * FROM $TableName";

$QueryResult = @mysqli_query($DBConnect, $SQLstring)           

                Or die("<p>Unable to Read the table.</p>"

                                . "<p>Error code " . mysqli_errno($DBConnect)

                                . "; " . mysqli_error($DBConnect)) . "</p>";

                               

$SQLstring = "DELETE FROM persons WHERE personID=$PersonID";        // Delete a Record

$QueryResult = @mysqli_query($DBConnect, $SQLstring)

                Or die("<p>Unable to delete the record.</p>"

                                . "<p>Error code " . mysqli_errno($DBConnect)

                                . "; " . mysqli_error($DBConnect)) . "</p>";

echo "<p>Successfully deleted the record.</p>"; 

               

mysqli_close($DBConnect);       

?>

<p><a href="indexMstr.php">Return to Menu Page</a></p>

</body>

</html>