-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremovecart.php
32 lines (31 loc) · 895 Bytes
/
removecart.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
<?php require 'config.php' ?>
<?php
session_start();
if(!isset($_SESSION['username']))
{
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
$url = "https://";
else
$url = "http://";
$url.= $_SERVER['HTTP_HOST'];
$url.= $_SERVER['REQUEST_URI'];
$_SESSION['back']=$url;
header('Location:'.'signin.php');
}
if(!isset($_GET['pid']))
{
header('Location:'.'catalogue.php');
}
$accountid=$_SESSION['accountid'];
$pid=$_GET['pid'];
$qty=$_GET['qty'];
$sql="update grocerycart set qty=$qty,total=price*$qty where productid=$pid and accountid=$accountid";
$conn->query($sql);;
if($conn->query($sql)===TRUE)
{
//header('Location:'.'cart.php');
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
?>