Skip to content

Instantly share code, notes, and snippets.

@BaylorRae
Created October 8, 2012 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BaylorRae/3850422 to your computer and use it in GitHub Desktop.
Save BaylorRae/3850422 to your computer and use it in GitHub Desktop.
array(
'url' => '...',
'title' => '...',
'author' => '...',
'id' => 123 // the new item
)
if( $stmt->execute($_POST['website'] + array('id' => $_GET['id'])) ) {
<?php
/**
* delete.php
*/
include 'global.php';
// the id wasn't passed
if( !isset($_GET['id']) ) {
header("Location: index.php");
}
// prepare the query to find the website by id
$stmt = $dbh->prepare("DELETE FROM `websites` WHERE `id` = :id");
// execute the query with the current id
if( $stmt->execute(array('id' => $_GET['id'])) ) {
header("Location: index.php");
}
echo "failed to delete the item";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment