-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
75 lines (57 loc) · 2.57 KB
/
categories.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
<?php include('partials-front/menu.php'); ?>
<!-- CAtegories Section Starts Here -->
<section class="categories">
<div class="container">
<h2 class="text-center">Explore Foods</h2>
<?php
//Display all the cateories that are active
//Sql Query
$sql = "SELECT * FROM tbl_category WHERE active='Yes'";
//Execute the Query
$res = mysqli_query($conn, $sql);
//Count Rows
$count = mysqli_num_rows($res);
//CHeck whether categories available or not
if($count>0)
{
//CAtegories Available
while($row=mysqli_fetch_assoc($res))
{
//Get the Values
$id = $row['id'];
$title = $row['title'];
$image_name = $row['image_name'];
?>
<a href="<?php echo SITEURL; ?>category-foods.php?category_id=<?php echo $id; ?>">
<div class="box-3 float-container">
<?php
if($image_name=="")
{
//Image not Available
echo "<div class='error'>Image not found.</div>";
}
else
{
//Image Available
?>
<img src="<?php echo SITEURL; ?>images/category/<?php echo $image_name; ?>" alt="Pizza" class="img-responsive img-curve">
<?php
}
?>
<h3 class="float-text text-white"><?php echo $title; ?></h3>
</div>
</a>
<?php
}
}
else
{
//CAtegories Not Available
echo "<div class='error'>Category not found.</div>";
}
?>
<div class="clearfix"></div>
</div>
</section>
<!-- Categories Section Ends Here -->
<?php include('partials-front/footer.php'); ?>