<?php
require_once('functions.php');

$user=$_SESSION['user'];
require_once('mysql.php');


$qty=mysqli_real_escape_string($dbc,($_POST['qty']));
$price=mysqli_real_escape_string($dbc,($_POST['price']));
$m=mysqli_real_escape_string($dbc,($_POST['m']));
$p=mysqli_real_escape_string($dbc,($_POST['p']));

$mj=mysqli_query($dbc,("select product_id from products where p_name='$p' limit 1"));
  $sw=mysqli_fetch_array($mj);
     $di=$sw['product_id'];
$tota=$price*$qty;
$fr=mysqli_query($dbc,("UPDATE stocking SET price='$price', product_id='$di',qty='$qty', total_p='$tota'
WHERE id = '$m'"));

  header("location: stocking.php");
		


mysqli_close($dbc)

	
?>