-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
44 lines (41 loc) · 977 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
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$username = '...';
$password = '...';
$host = 'localhost';
$dbname = 'ProjectDatabase';
?>
<!DOCTYPE html>
<html>
<head>
<title>Delete a movie</title>
</head>
<body>
<p>
<?php
echo "Deleting movie: " . $_POST["title"] . "...";
$sql = 'DELETE FROM movie_info WHERE title = "' . $_POST["title"] . '"';
try {
$conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec($sql);
echo "Movie deleted successfully";
?>
<p>You will be redirected in 3 seconds</p>
<script>
var timer = setTimeout(function() {
window.location='start.php'
}, 3000);
</script>
<?php
} catch(PDOException $e) {
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
</p>
</body>
</div>
</html>