Last active
August 29, 2015 14:13
-
-
Save srph/a2ac2edf4682f55b78bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'database.php'; | |
if ( !isset($_GET['id']) ) { | |
echo 'Please specify the id of the user to be deleted!'; | |
die(); | |
} | |
$query = 'DELETE FROM `user` WHERE id = :id'; | |
$statement = $pdo->prepare($query); | |
//bind the id of the record to be deleted | |
//use "i" letter for integer | |
$statement->bind_param(":id", $_GET['id']); | |
//execute delete statement | |
$statement->excute(); | |
//close the prepared statement | |
$statement->close(); | |
//redirect to index page | |
//parameter used to tell once data been deleted | |
header('Location:index.php? action=delete'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment