-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategories.php
66 lines (55 loc) · 2.63 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
<?php include('partials-front/navbar.php');?>
<!--categories section starts here-->
<section class="categories">
<div class="container">
<h2 class="text-center">Explore Foods</h2>
<?php
// display all the categories 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);
if($count > 0)
{
// categories available
while ($row=mysqli_fetch_assoc($res))
{
$id = $row['id'];
$title = $row['title'];
$image_name = $row['image_name'];
?>
<a href="<?php echo SETURL;?>categories-food.php?category_id=<?php echo $id; ?>">
<div class="box-1 float-container">
<?php
if ($image_name =='')
{
// image not available
echo '<div class="error">Images are not added yet. Stay Tuned!</div>';
}
else
{
// image is available
?>
<img src="<?php echo SETURL;?>images/category/<?php echo $image_name; ?>" class="img-responsive img-curve">
<?php
}
?>
<h3 class="float-text"><?php echo $title ;?></h3>
</div>
</a>
<?php
}
}
else
{
// categories not available
echo '<div class="error">Categories are not added yet. Stay Tuned!</div>';
}
?>
<div class="clearfix"></div>
</div>
</section>
<!--categories section ends here-->
<?php include('partials-front/footer.php');?>