-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalvar-excluir.php
47 lines (34 loc) · 1.18 KB
/
salvar-excluir.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
switch($_REQUEST["acao"]){
case "autor":
$sql = "DELETE FROM autor WHERE id_autor=".$_REQUEST["id_autor"];
$result = $conn->query($sql);
if($result){
print "<script>alert('Excluiu com sucesso!');</script>";
print "<script>location.href='index.php?page=editar-autor';</script>";
}else{
print "<div class='alert alert-danger'>Houve um problema.</div>";
}
break;
case "categoria":
$sql = "DELETE FROM categoria WHERE id_categoria=".$_REQUEST["id_categoria"];
$result = $conn->query($sql);
if($result){
print "<script>alert('Exluiu com sucesso!');</script>";
print "<script>location.href='index.php?page=editar-categoria';</script>";
}else{
print "<div class='alert alert-danger'>Houve um problema.</div>";
}
break;
case "livro":
$sql = "DELETE FROM livros WHERE id_livros=".$_REQUEST["id_livros"];
$result = $conn->query($sql);
if($result){
print "<script>alert('Excluiu com sucesso!');</script>";
print "<script>location.href='index.php?page=editar-livros';</script>";
}else{
print "<div class='alert alert-danger'>Houve um problema.</div>";
}
break;
}
?>