-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cartadd.php
57 lines (35 loc) · 1.07 KB
/
cartadd.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
49
50
51
52
53
54
55
56
57
<?php
session_start();
$mail=$_SESSION['alogin'];
//$pname=$_SESSION['name'];
//$id=$_GET["id"];
$id=$_SESSION['pid'];
?>
<?php
$con=mysqli_connect("localhost","root","","organic_shop_db")or die ("Couldnt connect");
$viewbrand="Select * from tbl_product where alogin=$mail ";
//$viewbrand="Select * from tbl_product where name=$pname ORDER BY name ASC";
$d_seller_brand=mysqli_query($con,$viewbrand);
$rowp=mysqli_fetch_array($d_seller_brand);
$rd=$rowp['mail'];
$product_category=$rowp['product_category_id'];
$price=(int)$rowp['price'];
$cart_item_qty=(int)$_POST['qt'];
$cart_total=$cart_item_qty*$price;
$q_ins1="insert into tbl_cart(mail,product_category_id,qunty,amount)values($rd,$product_category,$cart_item_qty,$cart_total)";
$ins=mysqli_query($con,$q_ins1);
if($ins)
{
echo "<script type='text/javascript'>
alert('New product added successfully');
window.location='cart_view.php';
</script>";
}
else
{
echo "<script type='text/javascript'>
alert('Failed');
window.location='view_single.php';
</script>";
}
?>