forked from aqibos/CookbookNetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
29 lines (26 loc) · 761 Bytes
/
delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
session_start() ;
include 'db-credentials.php' ;
include 'create-recipe-form.php' ;
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
if(isset($_GET["recipe_id"]))
{
$recipe_id = $_GET["recipe_id"] ;
removeRecipe($conn, $recipe_id);
header('Location: my-recipes.php');
}
else
{
$id = $_GET["cookbook_id"] ;
removeFromDbType("Friends", "type_id", $id, $conn);
removeFromDbType("Tag", "type_id", $id, $conn);
removeFromDb("Recipe_list", "cookbook_id", $id, $conn);
removeFromDb("cookbook_list", "cookbook_id", $id, $conn);
removeFromDb("cookbook", "cookbook_id", $id, $conn);
header('Location: my-cookbooks.php');
}
?>