<?php
error_reporting(0);
@session_start();
include("config.php");

$product=$_POST[product];
$point=$_POST[point];
$qty=$_POST[qty];


$flag = $_REQUEST[flag];
$mode = $_REQUEST[mode];

/***********************************/
$id= $_POST[id];


          $query_up=sprintf("UPDATE product SET  proname='$product',point='%s'  WHERE id='%d' ",$point,$id); 
		if(!($resu=mysql_query($query_up))){echo $query_up.mysql_error(); exit;}
   
	if($_FILES["pimg"]["name"]!="") 
		{
				 
			 $fileload = $_FILES["pimg"]["name"];
			
			 $file_ext = explode(".",$fileload);
			 $myattach="pimg_".$id.".".$file_ext[1];
			 
			$destpath=$uploadpath.$myattach;
				 
			$file1 = move_uploaded_file($_FILES["pimg"]["tmp_name"],$destpath); 
			 $updatecategory=sprintf("UPDATE product SET pimg ='%s' WHERE id ='%d'", $myattach, $id);
			if(!($result = mysql_query($updatecategory))){echo $updatecategory.mysql_error();exit;}
		}	
			
		header("Location:add-inventory.php?flag=dn");
		exit;

	
?>
