<?php
	include('includes/config.php');
	
$name = $_POST['name'];
$brand = $_POST['brand'];
$model = $_POST['model'];
$type = $_POST['type'];
$serial = $_POST['serial'];
$unit = $_POST['unit'];
$qty = $_POST['quantity'];
/* $qty = $_POST['quantity']; */
$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',
			type='$type',
			serial='$serial',
			unit='$unit',
			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());	
	
?>
