<?
require_once('Connections/localhost.php'); 
mysql_select_db($database_localhost,$localhost);

//$productID = 'P001.N00001';
//$exp = '2012-01-05';
//$quan = '50';
//$own = 'O002';
$productID = $_POST['proID'];
$exp = $_POST['exp'];
$quan = $_POST['quan'];
$own = $_POST['own'];
$codeNum = $_POST['codeNum'];

$idSub = substr($productID, -11, 4);
$codeSub = substr($productID, -6, 6);

date_default_timezone_set('Etc/GMT-8');
$dateToday = date('Y-m-d', time());

//echo "<script>alert('".$productType."');</script>";
//$query = "select * from tbl_introprod where product_ID = '$idSub' and codeNum = '$codeSub'";


$query_search = "select * from tbl_introprod where product_ID = '$idSub'";
$query_search2 = "select * from tempid";
$query_exec = mysql_query($query_search) or die(mysql_error());
$query_exec2 = mysql_query($query_search2) or die(mysql_error());
$rows = mysql_num_rows($query_exec);
$row = mysql_fetch_array($query_exec);
$row2 = mysql_fetch_array($query_exec2);
$receiver = $row2['user_ID'];
$result = mysql_query("insert into tbl_introprod (product_ID,timeToIn,product_QUANTITY,expireDay,personForHander,OWNER,codeNum) value ('$idSub','$dateToday','$quan','$exp','$receiver','$own','$codeSub')");

//$row = mysql_fetch_array($result);


?>

