-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremovemovie.php
More file actions
74 lines (51 loc) · 1.56 KB
/
removemovie.php
File metadata and controls
74 lines (51 loc) · 1.56 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
session_start();
include('header.php');
include_once("db_connect.php");
if (empty($_SESSION['user_id'])){
header("Location: login.php");
}
//SQL query
$sql2 = "SELECT * FROM movies NATURAL JOIN user_movie WHERE user_id = '" .$_SESSION['user_id']."' ";
$result = mysqli_query($conn, $sql2);
//create array
$json_array = array();
//fill array
while($row = mysqli_fetch_assoc($result))
{
$json_array[] = array("movie_id" => $row['movie_id'], "movie_title" => $row['movie_title'],"releaseyear"=>$row['releaseyear'],"moviedb_id"=>$row['moviedb_id'],"imdb_id"=>$row['imdb_id']);
}
//convert array to json
$json_en_id = json_encode($json_array);
$json_de_id = json_decode($json_en_id);
// Close connection
mysqli_close($conn);
?>
<?php if ((isset($_SESSION['user_id']) )) { ?>
<head>
<link rel="stylesheet" href="css/style.css">
</head>
<center>
<table>
<tbody>
<tr>
<th colspan="3"><h1>My Movies - Removal</h1></th>
</tr>
<tr>
<th>Movie Title</th>
<th>Release Year</th>
</tr>
<?php foreach ($json_de_id as $mymovies) : ?>
<tr>
<td> <a href=processdeletemovie.php?id=<?php echo $mymovies->movie_id; ?> onclick="return confirm('Are you sure?')"><?php echo $mymovies->movie_title; ?></a> </td>
<td> <?php echo $mymovies->releaseyear; ?> </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</center
<center>
<P>
Click <a href="logout.php">here</a> to logout
</center>
<?php } ?>