-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
115 lines (107 loc) · 4.04 KB
/
index.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
<?php include('header.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container">
<h1 class="page-header text-center">MENU</h1>
<ul class="nav nav-tabs">
<?php
$sql="select * from category order by categoryid asc limit 1";
$fquery=$conn->query($sql);
$frow=$fquery->fetch_array();
?>
<li class="active"><a data-toggle="tab" href="#<?php echo $frow['catname'] ?>"><?php echo $frow['catname'] ?></a></li>
<?php
$sql="select * from category order by categoryid asc";
$nquery=$conn->query($sql);
$num=$nquery->num_rows-1;
$sql="select * from category order by categoryid asc limit 1, $num";
$query=$conn->query($sql);
while($row=$query->fetch_array()){
?>
<li><a data-toggle="tab" href="#<?php echo $row['catname'] ?>"><?php echo $row['catname'] ?></a></li>
<?php
}
?>
</ul>
<div class="tab-content">
<?php
$sql="select * from category order by categoryid asc limit 1";
$fquery=$conn->query($sql);
$ftrow=$fquery->fetch_array();
?>
<div id="<?php echo $ftrow['catname']; ?>" class="tab-pane fade in active" style="margin-top:20px;">
<?php
$sql="select * from product where categoryid='".$ftrow['categoryid']."'";
$pfquery=$conn->query($sql);
$inc=4;
while($pfrow=$pfquery->fetch_array()){
$inc = ($inc == 4) ? 1 : $inc+1;
if($inc == 1) echo "<div class='row'>";
?>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading text-center">
<b><?php echo $pfrow['productname']; ?></b>
</div>
<div class="panel-body">
<img src="<?php if(empty($pfrow['photo'])){echo "upload/noimage.jpg";} else{echo $pfrow['photo'];} ?>" height="225px;" width="100%">
</div>
<div class="panel-footer text-center">
₨ <?php echo number_format($pfrow['price'], 2); ?>
</div>
</div>
</div>
<?php
if($inc == 4) echo "</div>";
}
if($inc == 1) echo "<div class='col-md-3'></div><div class='col-md-3'></div><div class='col-md-3'></div></div>";
if($inc == 2) echo "<div class='col-md-3'></div><div class='col-md-3'></div></div>";
if($inc == 3) echo "<div class='col-md-3'></div></div>";
?>
</div>
<?php
$sql="select * from category order by categoryid asc";
$tquery=$conn->query($sql);
$tnum=$tquery->num_rows-1;
$sql="select * from category order by categoryid asc limit 1, $tnum";
$cquery=$conn->query($sql);
while($trow=$cquery->fetch_array()){
?>
<div id="<?php echo $trow['catname']; ?>" class="tab-pane fade" style="margin-top:20px;">
<?php
$sql="select * from product where categoryid='".$trow['categoryid']."'";
$pquery=$conn->query($sql);
$inc=4;
while($prow=$pquery->fetch_array()){
$inc = ($inc == 4) ? 1 : $inc+1;
if($inc == 1) echo "<div class='row'>";
?>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading text-center">
<b><?php echo $prow['productname']; ?></b>
</div>
<div class="panel-body">
<img src="<?php if($prow['photo']==''){echo "upload/noimage.jpg";} else{echo $prow['photo'];} ?>" height="225px;" width="100%">
</div>
<div class="panel-footer text-center">
₨ <?php echo number_format($prow['price'], 2); ?>
</div>
</div>
</div>
<?php
if($inc == 4) echo "</div>";
}
if($inc == 1) echo "<div class='col-md-3'></div><div class='col-md-3'></div><div class='col-md-3'></div></div>";
if($inc == 2) echo "<div class='col-md-3'></div><div class='col-md-3'></div></div>";
if($inc == 3) echo "<div class='col-md-3'></div></div>";
?>
</div>
<?php
}
?>
</div>
</div>
</body>
<footer><center>Thanks to Neovic | Brought To You By code-projects.org</center></footer>
</html>