-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.php
57 lines (45 loc) · 1.78 KB
/
index2.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
<?php
include_once("connection.php");
//$urutan="";
if($_GET["urutan"]==1){$urutan="b.Barang_nama";}
else if($_GET["urutan"]==2){$urutan="b.Barang_harga";}
else{$urutan="b.Barang_rating";}
$sql = "SELECT b.Barang_nama, b.Barang_harga, b.Barang_gambar, b.Barang_rating, b.Barang_ulasan,
sb.Url, s.Sumber_nama, s.Sumber_logo, s.Last_update
FROM barang b join sumber_barang sb on b.Barang_ID=sb.Barang_ID join sumber s on sb.Sumber_ID=s.Sumber_ID where b.Barang_nama like '%".$_GET["kata"]."%' order by ".$urutan." ASC";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0){
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
//--------------------------------------------------------------------------------------------------------------------------------------
?>
<div class="col-sm-4 col-lg-3 col-md-3">
<div class="thumbnail">
<img src="<?php echo $row["Sumber_logo"];?>" class="img-responsive" alt="">
<img src="<?php echo $row["Barang_gambar"];?>" class="img-responsive" >
<div class="caption">
<h4><a target="_blank" href="<?php echo $row["Url"];?>"><?php echo $row["Barang_nama"];?></a></h4>
<h4><?php echo "Rp " . number_format($row["Barang_harga"], 0, ",",".");?></h4>
</div>
<div class="ratings">
<p>
<?php
$x=$row["Barang_rating"];
while($x>0){
echo '<span class="glyphicon glyphicon-star"></span>';
$x=$x-1;
}
?>
(<?php echo $row["Barang_ulasan"];?>)
</p>
</div>
</div>
</div>
<?php
//--------------------------------------------------------------------------------------------------------------------------------------
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>