<?php

if(isset($_POST["carid"]))
{
	include "../actions/dbPDO.php";
	$dd = $_POST["carid"];
	$output = array();
	$sql = $db->prepare("SELECT * FROM cars WHERE carid = ? LIMIT 1");
	$sql->bindParam(1,$dd);
	$sql->execute();
  if($sql->rowCount()>0){$row = $sql->fetch(PDO::FETCH_ASSOC);
		$output["carid"]   		= $row["carid"];
		$output["brand"]    	= $row["brand"];
    	$output["kind"]     	= $row["kind"];
		$output["model"]    	= $row["model"];
		$output["color"]    	= $row["color"];
    	$output["letters"]  	= $row["letters"];
		$output["numbers"]   	= $row["numbers"];
        $output["lic_expire"] 	= $row["lic_expire"];
		$output["lic_photo"]  	= $row["lic_photo"];
  }
		$km = $db->prepare("SELECT * FROM naql WHERE carid = ? LIMIT 1");
		$km->bindParam(1,$dd);
		$km->execute();
	  if($km->rowCount()>0){$ro = $km->fetch(PDO::FETCH_ASSOC);
        $output["naqid"] 			= $ro["naqid"];
        $output["operationCard"]   	= $ro["operationCard"];
        $output["operation_expire"] = $ro["operation_expire"];
		$output["operation_no"]   	= $ro["operation_no"];
		$output["car_serial"]   	= $ro["car_serial"];
		
        $output["insurance_id"]   	= $ro["insurance_id"];
        $output["insurance_lic"]   	= $ro["insurance_lic"];
		$output["insurance_no"]   	= $ro["insurance_no"];
		$output["insurance_kind"]   = $ro["insurance_kind"];
		$output["insurance_money"]  = $ro["insurance_money"];
		$output["insurance_expire"] = $ro["insurance_expire"];
		$output["pre_check"]        = $ro["pre_check"];
		$output["pre_expire"]   	= $ro["pre_expire"];
		$output["active"]   		= $ro["active"];
		$output["father"]   		= $ro["father"];
		$output["audate"]   		= $ro["audate"];
		$output["last_update"]   	= $ro["last_update"];
		$output["gpsid"]   			= $ro["gpsid"];
		$output["serviceid"]   		= $ro["serviceid"];
		}
	echo json_encode($output);
}
?>
