-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchPage.php
54 lines (43 loc) · 1.56 KB
/
SearchPage.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
<?php $file = file_get_contents('header.php');
$content = eval("?>$file");
echo $content; ?>
<?php
include_once 'DataBaseConnection.php';
?>
<div class="container-fluid padding">
<?php
$search ="%". $_GET['search']."%";
$stmt = $pdo->query("select * from Item WHERE NAME LIKE '$search' or Item.type like '$search' ; ");
$i=0;
if(!($row = $stmt->fetch())){
echo "<p class='alert alert-danger text-center' > no data found </p>";
}
else{
$stmt = $pdo->query("select * from Item WHERE NAME LIKE '$search'or Item.type like'$search' ; ");
echo '<div class="row padding">';
while($row = $stmt->fetch() ){
if($i == 4 ){
$i=0 ;
echo '</div>
<hr class="my-4">
<div class="row padding">';
}
echo '<div class="col-md-3">
<div class="card">
<img class="card-img-top" src="css/GameImg/game'.$row['Id'].'.jpg">
<div class="card-body">
<h4 class="card-title">'.$row['Name'].'</h4>
<a href="itemPage.php?id='.$row['Id'].'" class="btn btn-outline-secondary" ' ;
if($row['Stock'] == 0 ) { echo 'style=" pointer-events: none;" >Out of Stock ' ; } else echo '> ' .$row['Price']. '$ ' ;
echo '</a>
</div>
</div>
</div>';
$i = $i +1 ;
}}
?>
</div>
</div>
<?php $file = file_get_contents('footer.php');
$content = eval("?>$file");
echo $content; ?>