<?php
require_once("../../../amssplus_connect.php");
$q=$_GET["q"];
$doc=$_GET["doc"];
$datepic=$_GET["datepic"];
$status=$_GET["status"];
$item_x=$_GET["item_x"];
$item_x=base64_encode($item_x);
$response="";
//ปีงบประมาณ
$sql = "select * from  budget_year where year_active='1' order by budget_year desc limit 1";
$dbquery = mysqli_query($connect,$sql);
$year_active_result = mysqli_fetch_array($dbquery);

$sql = "select  * from  plan_proj  where budget_year='$year_active_result[budget_year]' and name_proj like '%$q%' order by code_proj limit 5";
$dbquery = mysqli_query($connect,$sql);
while($result = mysqli_fetch_array($dbquery)){
	$code_proj = $result['code_proj'];
	$name_proj = $result['name_proj'];
$response=$response."<a href=?option=budget&task=main/withdraw&code_proj=$code_proj&index=1&doc=$doc&datepic=$datepic&status=$status&item_x=$item_x>$code_proj&nbsp;$name_proj</a>"."<br />";
}
$sql = "select  * from  plan_proj_2  where budget_year='$year_active_result[budget_year]' and name_proj like '%$q%' order by code_proj limit 5";
$dbquery = mysqli_query($connect,$sql);
while($result = mysqli_fetch_array($dbquery)){
	$code_proj = $result['code_proj'];
	$name_proj = $result['name_proj'];
	$response=$response."<a href=?option=budget&task=main/withdraw&code_proj=$code_proj&index=1&doc=$doc&datepic=$datepic&status=$status&item_x='$item_x'>$code_proj&nbsp;$name_proj</a>"."<br />";
}
echo $response;
?>
