-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
144 lines (103 loc) · 3.28 KB
/
search.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
if($_SERVER['REQUEST_METHOD']=='GET'){
include 'management/_dbconnect.php';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="./assets/images/icon.png" type="image/png">
<title>Recom</title>
<!--
- custom css link
-->
<link rel="stylesheet" href="./assets/css/main.css">
<link rel="stylesheet" href="./assets/css/media_query.css">
<!--
- google font link
-->
<link href="https://fonts.googleapis.com/css?family=Inter:100,200,300,regular,500,600,700,800,900" rel="stylesheet" />
</head>
<body>
<section class="movies">
<!--
- filter bar
-->
<div class="filter-bar">
<div class="filter-dropdowns">
<span><?php
$genre = $_GET['search'];
echo '<h2>ALL results with '.$genre.'</h2>'; ?>
</span>
</div>
</div>
<!--
- movies grid
-->
<div class="movies-grid">
<?php
$name = $_GET['search'];
// $genre = '["Action"]';
$sql = "Select * from movie where title LIKE '$name%' LIMIT 10";
// print_r($sql);
$result = mysqli_query($conn,$sql);
$num = mysqli_num_rows($result);
while($num != 0){
$row = mysqli_fetch_assoc($result);
// print_r($row['image']);
$image = explode(", ",$row['image']);
$image = explode("'",$image[1]);
$genre = preg_replace("/,/","/",$row['genre']);
$genre = str_replace([']','[','"'],'',$genre);
$num -=1;
echo '<div class="movie-card">
<div class="card-head">
<img src="'.$image[1].'" alt="" class="card-img">
<div class="card-overlay">
<div class="bookmark">
'.$row['runtime'].'min
</div>
<div class="rating">
<ion-icon name="star-outline"></ion-icon>
<span>'.$row['rating'].'</span>
</div>
<div class="play">
<ion-icon name="play-circle-outline"></ion-icon>
</div>
</div>
</div>
<div class="card-body">
<form action="list/index.php" method="GET">
<button type="submit">
<h3 class="card-title">'.$row['title'].'</h3>
<input style="display:none;" value='.$row['movie_id'].' type="text" name="movieid" id="movieid">
</button>
</form>
<div class="card-info">
<span class="genre">'.$genre.'</span>
<span class="year">'.$row['year'].'</span>
</div>
</div>
</div>';
}
?>
</div>
<!--
- load more button
-->
<button class="load-more">LOAD MORE</button>
</section>
<!--
- custom js link
-->
<script src="./assets/js/main.js"></script>
<!--
- ionicon link
-->
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
</body>
</html>