<?php
	include('includes/config.php');
	
$name = $_POST['name'];
$brand = $_POST['brand'];
$model = $_POST['model'];
$cal = $_POST['cal'];
$type = $_POST['type'];
$serial = $_POST['serial'];
$qty = $_POST['quantity'];
//$unit = $_POST['unit'];
$price = $_POST['price'];
$license = $_POST['license'];
$permit_from = $_POST['permit_from'];
$permit_to = $_POST['permit_to'];
/* calling */
$pc_time = $_POST['pc_time'];
$pc_date = $_POST['pc_date'];
$user = $_POST['user'];
/* calling */

$out = array();
	foreach ($guards as $value) {
		array_push($out, "$value");
	}	
	
		SESSION_START();

		$equip = $_POST['id'];
		
		
		mysql_query("UPDATE equipments SET name ='$name',
			brand ='$brand',
			model ='$model',
			cal='$cal',
			type='$type', 
			serial='$serial',
			quantity='$qty',
			price ='$price',
			license ='$license',
			permit_from='$permit_from', 
			permit_to ='$permit_to',
			guards ='".implode('<br />', $out) ."'	WHERE equip_id ='$equip'") or die(mysql_error());  
		
echo "success";
/* insert na lang daun sa history log */	
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)VALUES('$equip', 'updated equipment', '$pc_date $pc_time', '$user')")or die(mysql_error());	
	
?>
