-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshop.php
More file actions
81 lines (75 loc) · 2.88 KB
/
Copy pathshop.php
File metadata and controls
81 lines (75 loc) · 2.88 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
<!DOCTYPE html>
<?php
require 'common.php';
if ( !isset($_SESSION['name']))
{ header('location: index.php');
}
$select_query = "SELECT id,name,class,quantity,images FROM items WHERE category='Primary' ";
$select_query_result = mysqli_query($con, $select_query) or die(mysqli_error($con));
?>
<html>
<head>
<title>BOOK Store</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link href="index.css" rel="stylesheet" type="text/css">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bootstrap/js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="bootstrap/js/jquery-3.3.1.min.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php
include 'header.php';
include 'hello.php';
include 'checkif.php';
?>
<!--mid-->
<div class="container-fluid">
<div class="row text-center">
<?php while ($row = mysqli_fetch_array($select_query_result)) { ?>
<div class="col-md-3">
<div class="thumbnail">
<?php
$pro_img = $row['images'];
$pro_id=$row['id'];
if($pro_img=="")
echo "<img src='product_image/nopes.jpg' alt='Lights' style='width:100%; height: 220px;' />";
else
echo "<img src='product_image/$pro_img' alt='Lights' style='width:100%; height: 220px;' />";
?>
<div class="caption">
<h3><?php echo $row['name']; ?></h3>
<p>Class:-<?php echo $row['class']; ?></p>
<p>Quantity:-<?php echo $row['quantity']; ?></p>
<?php
if (checkifadded($pro_id)) {
echo '<a href="#" class="btn btn-block btn-success" disabled>Added to cart</a>'; }
else { ?>
<a href="shop.php?imd=<?php echo $pro_id;?>" name="add" value="add" class="btn btn-block btn-primary">Add to cart</a>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
include 'footer.php';
?>
</body>
</html>
<?php
if(isset($_GET['imd']))
{
$u_id=$_SESSION['id'];
$p_id = $_GET['imd'];
$insert_pro ="INSERT INTO `users_items`
(`user_id`, `item_id`)
VALUES ('$u_id', '$p_id')";
$run_che = mysqli_query($con, $insert_pro)or die(mysqli_error($con));
echo "<script type='text/javascript'>window.open('shop.php','_self')</script>";
exit();
}
?>