deleteCategory page completed

This commit is contained in:
Joshua Perry 2022-11-19 15:43:06 +00:00
parent 80f967eb3a
commit c955912c2b
2 changed files with 26 additions and 1 deletions

View File

@ -24,4 +24,5 @@ if (isset($_POST['submit'])) {
];
$stmt->execute($values);
echo '<script>window.location.href = "adminCategories.php";</script>';
}
}
?>

View File

@ -0,0 +1,24 @@
<?php
session_start();
$pageTitle = 'iBuy - Delete Category';
$stylesheet = '../assets/ibuy.css';
require_once '../../functions.php';
adminCheck();
if (isset($_GET['category_id'])) {
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
$stmt = $pdo->prepare('DELETE FROM category WHERE category_id= :category_id');
$values = [
'category_id' => $_GET['category_id']
];
$stmt->execute($values);
echo '<script>window.location.href = "adminCategories.php";</script>';
}
else {
echo '<script>window.location.href = "adminCategories.php";</script>';
}
?>