<?php
require_once("config.php");//memanggil file config.php
connect_db();//memanggil fungsi connect_db
if($_post["tombol"]=="cari")
{
$radius=$_POST["radius"];
$latitude=$_POST["latitude"];
$longitude=$_POST["longitude"];
$query=mysql_query("select facilityname,
(((acos(sin((".$latitude."*pi()/180))*sin(('facilitylatitude
'*pi()/180))+cos((".$latitude."*pi()/180))*cos
(('facilitylatitude'*pi()/180))*cos(((".$longitude."-
'facilitylongitude')*pi()/180))))*180/pi())*60*1.1515*
1.609344)as distance from facility HAVING distance
<=".$radius);
$row=mysql_fetch_row($query);
if(!$row)
echo"fasilitas umum tidak ditemukan";
else
{
echo"<h2>daftar fasilitas umum terdekat</h2>";
echo"<table border=1 width='50%'>";
echo"<tr>";
echo"<th>fasilitas umum</th>";
echo"<th>jarak (KM)</th>";
echo"</tr>";
do{
list($nama,$jarak)=$row;
echo"<tr>";
echo"<td>$nama</td>";
echo"<td>".round($jarak,2)."</td>";
echo"</tr>";
}while($row=mysql_fetch_row($query));
echo"</table><br/>";
}
}
?>
<html>
<head>
<title>cari fasilitas umum terdekat</title>
<script type="text/javascript"scr="jquery.js">
</script>
<script type="text/javascript"scr="latlang.js">
</script>
<script type="text/javascript"scr="http://maps.
google.com/maps/api/js?sensor=false"></script>
</head>
<body>
<from method="post">
<h2>cari fasilitas umum terdekat</h2>
<table>
<tr><td>alamat anda</td><td><input type="text"
name="alamat"size="50" id="alamat" /></td></tr>
<tr><td>radius</td><td><input type="text" name=
"radius"size="5"id="radius" /><td></tr>
<tr><td>latitude</td><td><input type="text" name=
"latitude"size="30"id="latitude"readonly/></td></tr>
<tr><td>longitude</td><td><input type="text" name=
"longitude"size="30"id="longitude"readonly/></td></tr>
<tr><td></td><td><input id="koordinat" name=
"koordinat"type="button"value="tandai lokasi pada peta"/></td></tr>
<tr><td></td><td><input type="submit" name ="tombol"
value="cari"/></td></tr>
</table>
<br/>
<a href="index.php">input fasilitas umum</a>
<div id="map"style="width:512px; height:400px;"></div>
</form>
</body>
</html>
require_once("config.php");//memanggil file config.php
connect_db();//memanggil fungsi connect_db
if($_post["tombol"]=="cari")
{
$radius=$_POST["radius"];
$latitude=$_POST["latitude"];
$longitude=$_POST["longitude"];
$query=mysql_query("select facilityname,
(((acos(sin((".$latitude."*pi()/180))*sin(('facilitylatitude
'*pi()/180))+cos((".$latitude."*pi()/180))*cos
(('facilitylatitude'*pi()/180))*cos(((".$longitude."-
'facilitylongitude')*pi()/180))))*180/pi())*60*1.1515*
1.609344)as distance from facility HAVING distance
<=".$radius);
$row=mysql_fetch_row($query);
if(!$row)
echo"fasilitas umum tidak ditemukan";
else
{
echo"<h2>daftar fasilitas umum terdekat</h2>";
echo"<table border=1 width='50%'>";
echo"<tr>";
echo"<th>fasilitas umum</th>";
echo"<th>jarak (KM)</th>";
echo"</tr>";
do{
list($nama,$jarak)=$row;
echo"<tr>";
echo"<td>$nama</td>";
echo"<td>".round($jarak,2)."</td>";
echo"</tr>";
}while($row=mysql_fetch_row($query));
echo"</table><br/>";
}
}
?>
<html>
<head>
<title>cari fasilitas umum terdekat</title>
<script type="text/javascript"scr="jquery.js">
</script>
<script type="text/javascript"scr="latlang.js">
</script>
<script type="text/javascript"scr="http://maps.
google.com/maps/api/js?sensor=false"></script>
</head>
<body>
<from method="post">
<h2>cari fasilitas umum terdekat</h2>
<table>
<tr><td>alamat anda</td><td><input type="text"
name="alamat"size="50" id="alamat" /></td></tr>
<tr><td>radius</td><td><input type="text" name=
"radius"size="5"id="radius" /><td></tr>
<tr><td>latitude</td><td><input type="text" name=
"latitude"size="30"id="latitude"readonly/></td></tr>
<tr><td>longitude</td><td><input type="text" name=
"longitude"size="30"id="longitude"readonly/></td></tr>
<tr><td></td><td><input id="koordinat" name=
"koordinat"type="button"value="tandai lokasi pada peta"/></td></tr>
<tr><td></td><td><input type="submit" name ="tombol"
value="cari"/></td></tr>
</table>
<br/>
<a href="index.php">input fasilitas umum</a>
<div id="map"style="width:512px; height:400px;"></div>
</form>
</body>
</html>
yang lengkap donk...index.php gx ada terus confiq jg gx ada...
BalasHapusfile config.php nya ga ada ya gan?
BalasHapus