<?php
include '../../connect.php';
session_start();

$kenderaanID=$_GET["kenderaanID"];

$model =strtoupper($_POST['model']);

date_default_timezone_set("Asia/Kuala_Lumpur");			
$date=date('Y-m-d');
$time=date('H:i:sa');

	if( $model == "" )
	{
		mysqli_commit($conn);
		echo "<script>alert('Sila lengkapkan maklumat kenderaan. ');";
		echo "window.location.href = '../ubahsuaiKenderaan.php?kenderaanID=$kenderaanID';</script>";
		exit;
		
	}
	else
	{
			
			$query="UPDATE `kenderaan` SET kenderaanID='".$kenderaanID."', jenisKereta='".$model."' WHERE kenderaanID='".$kenderaanID."'";
			$strQuery = mysqli_query($conn,$query);
			
			if($strQuery) 
				{								
					echo "<script>alert('Kemaskini berjaya!');";
					echo "window.location.href = '../daftarKenderaan.php';</script>";
					exit;
					
				}
				else
				{
					echo 'MySQL Error: ' . mysqli_error($conn);
					exit;
					
				}
		
	}
?>

