<?php
require_once('mysql.php');
				  if (isset($_GET['id']))
	{

$id = $_GET['id'];
//$messages_id = $_GET['id'];
$result = mysqli_query($dbc,("SELECT * FROM trans where trans_id='$id'"));
while($row = mysqli_fetch_array($result))
  {
  $code=$row['product_id'];
  $f=$row['qty'];
   //$number=$row['t_code'];
   //$session=$row['session'];
  }
$result1 = mysqli_query($dbc,("SELECT * FROM products where product_id='$code'"));

while($row1 = mysqli_fetch_array($result1))
  {
  $pleft=$row1['left_p'];
    $name=$row1['p_name'];
  }
  
$dugang=$pleft+$f;

$gh=mysqli_query($dbc,("UPDATE products SET left_p = '$dugang'
WHERE product_id = '$code'"));


$v=("DELETE FROM trans WHERE trans_id='$id'");
$vv=mysqli_query($dbc,$v);

header("location: invii.php");
//mysql_close($con);
}
?>