<?php
require_once("varables.php");

$myJSON["srchcus"]=array();
$myJSON['success']="خطای اعتبار سنجی";
 
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
if($_POST["nekot"] == "19911")
{
	$srch = $_POST["an1d"];
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
		@mysqli_query($connect,"SET CHARACTER SET utf8;");
		$query_all = "SELECT id,C_name,C_mobile FROM ".$tbl_customer." WHERE C_name LIKE '%" .$srch. "%' OR C_mobile LIKE '%" .$srch. "%'  ORDER BY C_name";
		$result = @mysqli_query($connect,$query_all);
		if($result){
			while($row = @mysqli_fetch_assoc($result))	{
				array_push($myJSON["srchcus"], $row);
			}
			$myJSON['success']="200";
		}
			else {
				$myJSON['success']=@mysqli_error($connect);
			}
	}
	 else
		 $myJSON['success']=@mysqli_error($connect);
}
echo json_encode($myJSON);
?>