<?php
	session_start();
	require_once 'db_connection.php'; 
	$tempid = $_POST['tempid'];
	$name = $_POST['name']; 
    $qty = $_POST['qty']; 
    $discount = $_POST['discount']; 
    $tax = $_POST['tax']; 
    $price = $_POST['price']; 
    $marketprice = $_POST['marketprice']; 
    $distype4 = $_POST['distype']; 

    $lastchar = substr($tax, -1); 
    
    $lastchar1 = substr($discount, -1); 

    if($lastchar=="%"){
        $taxrate = intval(substr($tax, 0, -1));
        $taxtype = 1;
    }else{
        $taxrate = $tax;
        
        $taxtype = 0;
    }
    

    if($lastchar1=="%"){
        $disrate = intval(substr($discount, 0, -1));
        $distype = 1;
    }else{
        $disrate = $discount;
        
        $distype = 0;
    }
    



    $sql3 = "UPDATE mobiletemporarycart SET tax='$taxrate',tax_type='$taxtype',pro_name='$name',pro_qty='$qty',pro_discount='$disrate',discount_type='$distype4',pro_price='$price',market_price2='$marketprice' WHERE tempid='$tempid'";
	if ($conn->query($sql3) === TRUE) {
		echo "1";
	}else{
		echo 0;
	}
    
?>