-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchedTrack.php
214 lines (195 loc) · 8.12 KB
/
SearchedTrack.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
session_start(); ?>
<html lang="en">
<!--<![endif]-->
<head>
<!-- Title -->
<title>MusicApp</title>
<!-- Meta -->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- Favicon -->
<link href="favicon.ico" rel="shortcut icon">
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.css" rel="stylesheet">
<!-- Template CSS -->
<link rel="stylesheet" href="assets/css/animate.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/nexus.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/responsive.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css" rel="stylesheet">
<!-- Google Fonts-->
<link href="http://fonts.googleapis.com/css?family=Raleway:100,300,400" type="text/css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Roboto:400,300" type="text/css" rel="stylesheet">
</head>
<body>
<!-- Header -->
<div id="header" style="background-position: 50% 0%; <br />
<b>Notice</b>: Undefined variable: full_page in <b>C:\xampp\htdocs\bootstrap\html\php\header.php</b> on line <b>46</b><br />
" data-stellar-background-ratio="0.5">
<div class="container">
<div class="row">
<!-- Logo -->
<div class="logo">
<a href="index.html" title="">
<img src="assets/img/music.jpg" alt="Logo" />
</a>
</div>
<!-- End Logo -->
</div>
<!-- Top Menu -->
<div id="hornav" class="row text-light">
<div class="col-md-12">
<div class="text-center visible-lg">
<ul id="hornavmenu" class="nav navbar-nav">
<li>
<a href="index.php" class="fa-home active">Home</a>
</li>
<?php if ($_SESSION) { ?>
<li><a href= "#" class="fa-comment">WELCOME <?php echo $_SESSION['emailid']; ?> </a></li>
<li><a href="logout.php" class="fa-gears">LOGOUT</a></li>
<?php
}
?>
<?php if (!$_SESSION) { ?>
<li><a href="login.php" class="fa-gears">LOGIN</a></li>
<?php
}
?>
<li>
<a href="pages-sign-up.html" class="fa-copy ">Signup</a>
</li>
<li>
<a href="DisplayTracks.php" class="fa-copy ">MusicList</a>
<ul>
<!-- <li>
<a href="portfolio-2-column.html">2 Column</a>
</li>
<li>
<a href="portfolio-3-column.html">3 Column</a>
</li>
<li>
<a href="portfolio-4-column.html">4 Column</a>
</li>
<li>
<a href="portfolio-6-column.html">6 Column</a>
</li>-->
</ul>
</li>
<?php if ($_SESSION) { ?>
<li>
<a href="admin.php" class="fa-font ">Admin</a>
<?php
}
?>
<?php if ($_SESSION) { ?>
<li>
<a href="cart.php" class="fa-shopping-cart ">Cart</a>
</li>
<?php
}
?>
</ul>
</div>
</div>
</div>
<!-- End Top Menu -->
</div>
</div>
<div id="hornav" class="row text-light">
<div class="col-md-12">
<div class="text-center visible-lg">
<ul id="hornavmenu" class="nav navbar-nav">
<li>
<a href="index.php" class="fa-home active">Home</a>
</li>
<li>
<a href="pages-login.html" class="fa-gears ">Login</a>
</li>
<li>
<a href="pages-sign-up.php" class="fa-copy ">Signup</a>
</li>
<li>
<a href="DisplayTracks.php" class="fa-copy ">MusicList</a>
<ul>
<!-- <li>
<a href="portfolio-2-column.html">2 Column</a>
</li>
<li>
<a href="portfolio-3-column.html">3 Column</a>
</li>
<li>
<a href="portfolio-4-column.html">4 Column</a>
</li>
<li>
<a href="portfolio-6-column.html">6 Column</a>
</li>-->
</ul>
</li>
<?php if ($_SESSION) { ?>
<li>
<a href="admin.php" class="fa-font ">Admin</a>
</li>
<?php
}
?>
</ul>
</div>
</div>
</div>
<form method="post" action="SearchedTrack.php">
<div class="form-group">
<input type="text" name="Search" class="form-control" placeholder="Search by track name">
<input class="btn btn-primary" style="margin-top: 15px;margin-left: 575px" name="search" type="submit" value="Search For tracks">
</div>
</form>
<?php
/**
* Created by PhpStorm.
* User: YASH CHATURVEDI
* Date: 12/11/2016
* Time: 11:27 AM
*/
include("config.php");
//error_reporting(0);
$result = $mysqli->query("SELECT *,a.Title as album,g.Name as genre,t.name as Name FROM `track` as t,album as a, genre as g WHERE t.AlbumId=a.AlbumId AND t.GenreId=g.GenreId And (t.Name LIKE '%$_POST[Search]%' OR a.Title LIKE '%$_POST[Search]%' OR t.Composer LIKE '%$_POST[Search]%' OR g.Name LIKE '%$_POST[Search]%') ORDER BY t.TrackId ASC");
?>
<table border="2" bgcolor="">
<tr>
<td align="center"><b>Trackid</b></td>
<td align="center"><b>Name</b></td>
<td><b>Album</b></td>
<td><b>Price</b></td>
<td><b>Genre</b></td>
<td align="center"><b>Composer</b></td>
</tr>
<tbody>
<?php
$num = $result->num_rows;
for($i=0; $i<$num ; $i++) {
$item = mysqli_fetch_assoc($result); ?>
<tr>
<td><p></><?php echo $item['TrackId'];?></p></td>
<td><p><?php echo $item['Name'];?></p></td>
<td><p><?php echo $item['album'];?></p></td>
<td><p>$<?php echo $item['UnitPrice'];?></p></td>
<td><p><?php echo $item['genre'];?></p></td>
<td><p><?php echo $item['Composer'];?></p></td>
<td><a class="btn btn-info" onclick ="add_to_cart(<?php echo $item['TrackId'];?>)">Add to cart</a></td>
</tr>
<?php
}
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
function add_to_cart(id) {
$.post("add_to_cart.php", {id: id}, function(result){
alert(result);
});
}
</script>
</body>
</html>