-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcategory-pet.php
More file actions
165 lines (142 loc) · 5.22 KB
/
Copy pathcategory-pet.php
File metadata and controls
165 lines (142 loc) · 5.22 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
include('partials-front/menu.php');
?>
<!-- HTML category -->
<section class="pet-search text-center">
<br>
<br>
<br>
</section>
<!-- --x-- -->
<?php
// check whether id is passed or not
if (isset($_GET['category_id'])) {
// get category id
$category_id = $_GET['category_id'];
// get the category title based on category id
$sql = "SELECT title FROM tbl_category WHERE id=$category_id";
// execute the query
$res = mysqli_query($conn, $sql);
// get the value from database
$row = mysqli_fetch_assoc($res);
// get the title
$category_title = $row['title'];
} else {
// redirect to the homepage
header('location:' . SITEURL);
}
?>
<!--HTML Pet Menu Section Starts here -->
<section class="pet-menu">
<div class="container">
<h2 class="text-center">Pets on <a href="#" class="text-orange text-center"><?php echo $category_title; ?></a> Category</h2>
<!-- <br> -->
<!-- php code goes here -->
<!-- php code goes here -->
<!-- pet menu box start here -->
<?php
// getting pets from database that are actiavte and featured
// sql query
$sql2 = "SELECT * FROM tbl_pet WHERE active='Yes' AND category_id=$category_id ";
// execute the query
$res2 = mysqli_query($conn, $sql2);
// count rows
$count2 = mysqli_num_rows($res2);
// check whether pets are avaiable or not
if ($count2 > 0) {
// pet avaiable
while ($row = mysqli_fetch_assoc($res2)) {
// get all the values
$id = $row['id'];
$title = $row['title'];
$location = $row['location'];
$description = $row['description'];
$image_name = $row['image_name'];
?>
<!-- add html -->
<!-- -->
<div class="pet-menu-box">
<div class="pet-menu-img">
<!-- check image avaiable or not -->
<?php
if ($image_name == "") {
echo '<div class="error">Image not avaiable.</div>';
} else {
?>
<img src="<?php echo SITEURL; ?>images\pet\<?php echo $image_name; ?>" alt="" class="img-curve img-responsive">
<?php
}
?>
</div>
<div class="pet-menu-desc">
<h4><?php echo $title; ?></h4>
<p class="pet-status"><?php echo $location; ?></p>
<p class="pet-desc"><?php echo $description; ?></p>
<br>
<a href="<?php echo SITEURL; ?>adopt.php?pet_id=<?php echo $id; ?>" class="btn btn-primary">Adopt</a>
</div>
</div>
<!-- -->
<?php
}
} else {
echo '<div class="error">Pets not Added.</div>';
}
?>
<!-- <div class="pet-menu-box">
<div class="pet-menu-img">
<img src="images/menu-dog-1.png" alt="" class="img-curve img-responsive">
</div>
<div class="pet-menu-desc">
<h4>Pet Title</h4>
<p class="pet-status">Location</p>
<p class="pet-desc">Health condition is perfect</p>
<br>
<a href="adopt.html" class="btn btn-primary">Adopt</a>
</div>
</div> -->
</div>
<!-- pet menu box ends here -->
<!-- <div class="pet-menu-box">
<div class="pet-menu-img">
<img src="images/menu-dog-4.png" alt="" class="img-curve img-responsive">
</div>
<div class="pet-menu-desc">
<h4>Pet Title</h4>
<p class="pet-status">Location</p>
<p class="pet-desc">Health condition is perfect</p>
<br>
<a href="#" class="btn btn-primary">Adopt</a>
</div>
</div>
<div class="pet-menu-box">
<div class="pet-menu-img">
<img src="images/menu-dog-5.png" alt="" class="img-curve img-responsive">
</div>
<div class="pet-menu-desc">
<h4>Pet Title</h4>
<p class="pet-status">Location</p>
<p class="pet-desc">Health condition is perfect</p>
<br>
<a href="#" class="btn btn-primary">Adopt</a>
</div>
</div>
<div class="pet-menu-box">
<div class="pet-menu-img">
<img src="images/menu-dog-6.png" alt="" class="img-curve img-responsive">
</div>
<div class="pet-menu-desc">
<h4>Pet Title</h4>
<p class="pet-status">Location</p>
<p class="pet-desc">Health condition is perfect</p>
<br>
<a href="#" class="btn btn-primary">Adopt</a>
</div>
</div> -->
<div class="clearfix"></div>
</section>
<div class="mp-21"></div>
<!--HTML Pet Menu Section Ends here -->
<?php
include('partials-front/footer.php');
?>