	<?php
	session_start();
	require_once 'db_connection.php'; 
	$tempid = $_POST['tempid'];
	$amount = $_POST['amount'];
	$user_id = $_SESSION['user_id'];
	

	$result = mysqli_query($conn, "SELECT * FROM mobiletemporarycart WHERE tempid='$tempid'");
	$rw = mysqli_fetch_array($result);

	$proid = $rw['proid'];

	$products = mysqli_query($conn, "SELECT * FROM mobileproducts WHERE prid ='$proid'");
	$prinfo = mysqli_fetch_array($products);

	$productprice = $prinfo['sellprice'];


	$qprice = $amount / $productprice;
	$qty = 1 * $qprice;
	$sql3 = "UPDATE mobiletemporarycart SET pro_price = $amount,pro_qty = $qty WHERE tempid='$tempid'  ";
	if ($conn->query($sql3) === TRUE) {
		echo "1";
	}else{
		echo 0;
	}

	?>
