-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_cart_load.php
48 lines (42 loc) · 1.42 KB
/
ajax_cart_load.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
<?php
session_start();
include("connect.php");
$uid = $_SESSION['users_id'];
$sql = "SELECT * FROM tbl_addtocart WHERE user_id='$uid'";
$result = $connect->query($sql);
$count = 0; // Initialize count for tracking products in the row
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
?>
<div class="product-details">
<div class="product-image">
<img src="<?php echo $row['p_image']; ?>" alt="<?php echo $row['p_name']; ?>">
</div>
<div class="product-info">
<h2><?php echo $row['p_name']; ?></h2>
<p>Price: <?php echo $row['p_price']; ?></p><br>
<div class="add-to-cart">
<input type="submit" value="Remove From Cart" id="addtocart" class="delete-btn" data-id="<?php echo $row['product_id'] ?>">
</div>
<div class="buy">
<<<<<<< HEAD
<a href="payment.php"><input type="submit" value="Buy Now"></a>
=======
<input type="submit" value="Buy Now">
>>>>>>> origin/main
</div>
</div>
</div>
<?php
$count++; // Increment count for each product
// Clear the float after every third product
if ($count % 3 == 0) {
echo '<div style="clear:both;"></div>';
}
}
} else {
echo "<h1>No Products Are In Cart.</h1>";
}
$result->free();
$connect->close();
?>