deleteCategory page completed
This commit is contained in:
parent
80f967eb3a
commit
c955912c2b
|
|
@ -24,4 +24,5 @@ if (isset($_POST['submit'])) {
|
|||
];
|
||||
$stmt->execute($values);
|
||||
echo '<script>window.location.href = "adminCategories.php";</script>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -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>';
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue