-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproductTypes.php
More file actions
55 lines (50 loc) · 1.82 KB
/
Copy pathproductTypes.php
File metadata and controls
55 lines (50 loc) · 1.82 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
<div class="title-head">
<div class="shadows hidden">
<span>v</span>
<span>a</span>
<span>r</span>
<span>i</span>
<span>a</span>
<span>t</span>
<span>i</span>
<span>o</span>
<span>n</span>
</div>
</div>
<div class="productType-box-wrapper">
<button class="scroll-left" onclick="scrollProductType(-1)">‹</button>
<div class="productType-box-container hidden">
<?php
// Query to select product type
$sql = "SELECT productType_id, productType_status, productType_name, productType_description, productType_photo FROM producttype WHERE productType_status = 'active'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Output data of each row
while ($row = $result->fetch_assoc()) {
?>
<div class="productType-box">
<img src="admin/producttype/<?php echo $row['productType_photo']; ?>"
alt="<?php echo $row['productType_name']; ?>">
<h2><?php echo $row['productType_name']; ?></h2>
<p><?php echo $row['productType_description']; ?></p>
</div>
<?php
}
} else {
echo "No services found.";
}
?>
</div>
<button class="scroll-right" onclick="scrollProductType(1)">›</button>
</div>
<!-- javascipt for scrolling -->
<script>
function scrollProductType(direction) {
const container = document.querySelector('.productType-box-container');
const scrollAmount = container.clientWidth * 0.5; // Adjust this value to control the scroll distance
container.scrollBy({
left: scrollAmount * direction,
behavior: 'smooth'
});
}
</script>