<?php
	
	$dicari=mysqli_real_escape_string($mysqli, $_POST["tsearch"]);
	
	$qry=mysqli_query($mysqli,"SELECT * FROM m_desa WHERE nama_desa LIKE '%$dicari%' ORDER BY nama_desa ASC");

	echo "<h4>Hasil pencarian desa:</h4>";
	
	if(mysqli_num_rows($qry)>0){
		
		$no=1;
		echo "<ol>";
		while($data=mysqli_fetch_array($qry)){
			$qryx=mysqli_query($mysqli, "SELECT * FROM m_kecamatan WHERE id_kecamatan='$data[id_kecamatan]'");
			$datx=mysqli_fetch_array($qryx);
			$nmkec=$datx["nama_kecamatan"];
			echo "<li><a href='index.php?page=detail_desa&id=$data[id_desa]'>Desa $data[nama_desa] (Kecamatan: $nmkec)</a></li>";
		}
		echo "</ol>";

		echo "<br/><br/>&nbsp;";
		
		
	}else{
	
		echo "Data desa tidak ditemukan...";
	}
?>