Skip to content

Instantly share code, notes, and snippets.

@codingwithsara

codingwithsara/delete.php Secret

Created Mar 16, 2019
Embed
What would you like to do?
How to Save Image File with PHP & MySQL - Delete
<?php
require_once 'functions.php';
$pdo = connectDB();
$sql = 'DELETE FROM images WHERE image_id = :image_id';
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':image_id', (int)$_GET['id'], PDO::PARAM_INT);
$stmt->execute();
unset($pdo);
header('Location:list.php');
exit();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment