-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
55 lines (28 loc) · 776 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
if ($_SERVER["REQUEST_METHOD"] === "GET") {
$id = $_GET["id"];
require("database.php");
$sql = "DELETE FROM klienti WHERE id=$id";
$result = mysqli_query($connection, $sql);
header("location: /CRUD1/index.php");
exit;
};
//jina verze delete pomocí funkce
/*
function deleteKlient($connection, $id) {
$sql = "DELETE FROM klienti WHERE id = ?";
$id = $_GET["id"];
$stmt = mysqli_prepare($connection, $sql);
if ($stmt === false) {
echo mysqli_error($connection);
echo "Nastala chyba!";
} else {
mysqli_stmt_bind_param($stmt, "i", $id);
if (mysqli_stmt_execute($stmt)) {
header("location: /CRUD1/index.php");
exit;
};
};
};
*/
?>