delete.php (the file to execute delete process)

<?php
//extract all info from id
$empno=$_GET['id'];

//develop the SQL command to delete record
if($empno!=''){
$sql="delete from employee
where EMPNO='$empno'";

//database connection
$db=mysqli_connect("localhost","root","","mycompanyhr");

// checking database connection
if ($db==false) {
echo "Connect failed: ". mysqli_connect_error($db);
exit();
}
else {
echo "Connection successful";
}

//execute the SQL command
$rs=mysqli_query($db,$sql);

//check the execution status
if($rs==false){
echo "Record cannot be deleted!<br>";
echo "SQL Error : ".mysqli_error($db);
}
else{
echo "<br>Record for $empno deleted!<br>";
echo "<a href='simple-search.php'>
Back to the list</a>";
}
}//end NULL
?>

Popular Posts

WorldConferences.net