-
Notifications
You must be signed in to change notification settings - Fork 0
/
buy.php
48 lines (47 loc) · 1.29 KB
/
buy.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_once "conn.php"
?>
<html>
<head>
<link rel="stylesheet" href="userhome.css">
</head>
<div class="list">
<br><br>
<h2>Cart Items</h2>
</div>
<div class="tab">
<table border="1" align="center" cellspacing="25%" cellpadding="25%">
<tr>
<th>Name</th>
<th>Description</th>
<th>Price(Rs)</th>
<th>Image</th>
<th>Status</th>
<th>BUY</th>
</tr>
<?php
$uid=$_SESSION['id'];
$sql="SELECT name,description,price,image,status,carts.id FROM products,carts WHERE products.status='Available' AND carts.userid=$uid AND products.id=carts.productid";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
echo "<tr>";
echo "<td>" .$row['name']."</td>";
echo "<td>" .$row['description']."</td>";
echo "<td>" .$row['price']."</td>";
echo "<td>"."<img src=".$row['image']." style='height: 80px; width: 200px;'></td>";
echo "<td>" .$row['status']."</td>";
echo "<td><a href='checkout.php?ctid=".$row['id']."'>BUY</a></td>";
echo "</tr>";
}
}
else
{
echo "<p align='center'>No Products</a>";
}
?>
</table>
</div>