<?php
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
		 $t=time();
$username=$_SESSION["username"];
$userid=$_SESSION["userid"];
$invid=$_POST["invid"];
$discount=$_POST["discount"];


$size = count($_POST['retail_price']);

$i = 0;
while ($i < $size) {
	
	$disc = $_POST['disc'][$i];
	$id = $_POST['id'][$i];
	
	
	
	  $retail_price = $_POST['retail_price'][$i];
	   $cost_price = $_POST['cost_price'][$i];
	 
	$sql2 = "UPDATE items SET retail_price='$retail_price',cost_price='$cost_price',disc='$disc' WHERE id='$id'";
$conn->query($sql2);
	

	++$i;

// do the update and print out some info just to provide some visual feedback


} 

header("location:Open_Items.php");
?>
