 |
|
ค้นหา แล้วไม่แสดงผลครับ
หน้าหลัก
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name = "survey,phuket,land,property,real estate,gis,map,building inspection,phang nga,krabi,trang" />
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>-- Welcome To GIS Of Phuket Real Estate Association</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAp8Kea7yMPvD9pWTwFm5i6RSjqATFVhC925ljXMvjCUaxf-5uhRQhHCwqsGPq_hpXSBqt16W0FgUTQg" type="text/javascript"></script>
<script src="js/gmaps.CircleOverlay.js" type="text/javascript"></script>
<script type="text/javascript">
function getBanner(){
var k=l=m=n=0;
var url="";
var w =screen.width-400;
if(w<740 && w>=555){n=3;}
if(w<925 && w>=740){n=4;}
if(w<1110 && w>=925){n=5;}
if(w<1295 && w>=1110){n=6;}
if(w<1480 && w>=1295){n=7;}
k=8/n;
for(var i=0;i<n;i++){
m+=((Math.random()*k));
if(l==parseInt(m) && i!=0)
m+=1;
l=parseInt(m);
if(l>8)l=8;
if(l==0)url="http://www.baanrommai.net/index.html";
if(l==1)url="http://www.phuketgoldenville.com";
if(l==2)url="http://www.theheritagesuites.com";
if(l==3)url="http://www.jdpools.com";
if(l==4)url="";
if(l==5)url="http://www.sea-property-international.com/";
if(l==6)url="";
if(l==7)url="";
if(l==8)url="http://www.bangkokbank.com";
document.write("<a href=\""+url+"\" target=_blank ><img src=img/banner/"+l+".jpg width=185 height=55 /></a>");
m=k*(i+1);
}
}
var map;
var geocoder;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
map.addMapType(G_PHYSICAL_MAP);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(7.911414, 98.347236),13);
}
}
function searchLocationsNear() {
var asearch = document.getElementById('asearch').value;
var searchUrl = "search.php?asearch=" + asearch ;
GDownloadUrl(searchUrl, function(data){
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName('marker');
map.clearOverlays();
var sidebar3 = document.getElementById('sidebar3');
sidebar3.innerHTML = '';
if (markers.length == 0) {
sidebar3.innerHTML = 'No results found.';
map.setCenter(new GLatLng(7.911414, 98.347236),13);
return;
}
var bounds = new GLatLngBounds();
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lon")));
var marker = createMarker(point, name);
map.addOverlay(marker);
var sidebarEntry = createSidebarEntry(marker, name);
sidebar3.appendChild(sidebarEntry);
bounds.extend(point);
}
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
});
}
function createMarker(point, name) {
var marker = new GMarker(point, customIcons[type]);
var html = "<table width=300><tr><td>"+"ชื่อฟาร์ม:" + name + "</td></tr></table>";
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function createSidebarEntry(marker, name) {
var div = document.createElement('div');
var html = "<b>" + name + "</b><br/> ------------------------------ <br/>" ;
div.innerHTML = html;
div.style.cursor = 'pointer';
div.style.marginBottom = '5px';
GEvent.addDomListener(div, 'click', function() {
GEvent.trigger(marker, 'click');
});
GEvent.addDomListener(div, 'mouseover', function() {
div.style.backgroundColor = '#eee';
});
GEvent.addDomListener(div, 'mouseout', function() {
div.style.backgroundColor = '#fff';
});
return div;
}
</script>
<style type="text/css">
<!--
body {
background-image: url(picture/page1952.jpg);
}
.style1 {color: #FF0000}
.style2 {color: #FF9B9B}
.style3 {
font-size: 14px;
font-weight: bold;
}
.style4 {color: #0000FF}
.style5 {color: #00FF00}
-->
</style>
</head>
<body onload="load()" onunload="GUnload()">
<table cellspacing="0" cellpadding="0" align="center"><tr align="center"><td>
<!-- Header -->
<table border="0" WIDTH=100% CELLPADDING="0" CELLSPACING="0">
<tr>
<td align="center">
<table align="center" cellspacing="0" cellpadding="0"><tr>
<td width="250" align="center" /><div style="width:400px;">
<a href="../index.php"><img src="img/Logo.jpg" width="120" height="50" border="0" /><img src="img/Logo-title.jpg" width="222" height="50" border="0" /></a></div></td>
<!-- random banner -->
<script type="text/javascript">
document.write("<td>");
getBanner();
document.write("<td>");
</script>
</tr></table>
</td></tr>
<tr>
<td bgcolor="#6A8096"><div align="center">
<table width="100%" ><tr align="center">
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/index.php" target="_parent" class="link1" >Home</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/Aboutus.html" target="_parent"class="link1">About Us</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/Member.html" target="_parent" class="link1">List Of Meber</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/New.php" target="_parent" class="link1">News Update</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/Events.php" target="_parent" class="link1">Events&Activities</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/Webbord.php" target="_parent" class="link1">Webboard</a></span></td>
<td><span class="style14">||</span></td>
<td><span class="link1 style34"><a href="http://www.phuketrealestate.or.th/Contactas.html" target="_parent" class="link1">Contact Us</a></span></td>
<td><span class="style14">||</span></td>
</tr></table>
</div></td>
</tr>
</table>
</td></tr>
<tr><td>
<!-- TOC & MAP -->
<form action="#" onsubmit="showAddress(this.address.value); return false">
<table width="98%" cellpadding="0" cellspacing="0" align="center">
<tbody>
<tr>
<td valign="top" width="300px">
<div>
<input name="text" type="text" id="asearch" value="ใส่ข้อมูลที่จะใช้ค้นหา" size="25"/>
<input type="button" onclick="searchLocationsNear()" value="Search"/>
</div></p>
<div id="sidebar3" style="overflow: auto; height: 500px; font-size: 11px; color: #000"></div>
</td>
<td valign="top" align="center"><div id="map_canvas" style="width: 1150px; height: 650px"></div></td>
</tr>
</tbody>
</table></form>
</td></tr>
<tr align="center"><td>
<!-- Footer -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" bgcolor="#6A8096"><div align="center"><span class="style1" style="color:#fcef5e;">Copy rigth By Passurvey Co.,Ltd || Contoct:<a href=" mailto:[email protected]">[email protected]</a></span> <br />
</div></td>
</tr>
</table>
</td></tr>
</table>
</body>
</html>
หน้า sqlmx
ดึงค่าจากฐานข้อมูล
<?php
include ("connect.php");
// Get parameters from URL
//$fsearch = $_GET["fsearch"];
$asearch = $_GET["asearch"];
//$asearch = 'phuket';
// Start XML file, create parent node
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
// Opens a connection to a mySQL server
$connection=mysql_connect ($dbhostname, $dbusername, $dbpassword);
mysql_query("SET NAMES UTF8",$connection);
if (!$connection) {
die("Not connected : " . mysql_error());
}
// Set the active mySQL database
$db_selected = mysql_select_db($dbname, $connection);
if (!$db_selected) {
die ("Can\'t use db : " . mysql_error());
}
//$query = "select message.*, Detail.*, MessageType.* from message, Detail, MessageType where message.detailID = Detail.detailID and message.memberTypeID = MessageType.memberTypeID and message.name like '%$asearch%' or message.THname like '%$asearch%' or message.location like '%$asearch%' or MessageType.memberType like '%$asearch%'";
$query = "select message.*, Detail.*, MessageType.* from ( Detail inner join message on Detail.detailID=message.detailID ) inner join MessageType on message.memberTypeID=MessageType.memberTypeID where message.name like '%$asearch%' or message.THname like '%$asearch%' or message.location like '%$asearch%' or MessageType.memberType like '%$asearch%' or MessageType.THmemberType like '%$asearch%'";
$result = mysql_query($query);
if (!$result) {
die("Invalid query: " . mysql_error());
}
header("Content-type: text/xml");
// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("detailID", $row['detailID']);
$newnode->setAttribute("detail", $row['detail']);
$newnode->setAttribute("THdetail", $row['THdetail']);
$newnode->setAttribute("memberTypeID", $row['memberTypeID']);
$newnode->setAttribute("memberType", $row['memberType']);
$newnode->setAttribute("THmemberType", $row['THmemberType']);
$newnode->setAttribute("lat", $row['lat']);
$newnode->setAttribute("lon", $row['lon']);
$newnode->setAttribute("location", $row['location']);
$newnode->setAttribute("name", $row['name']);
$newnode->setAttribute("THname", $row['THname']);
$newnode->setAttribute("address", $row['address']);
$newnode->setAttribute("THaddress", $row['THaddress']);
$newnode->setAttribute("tel", $row['tel']);
$newnode->setAttribute("web", $row['web']);
$newnode->setAttribute("email", $row['email']);
$newnode->setAttribute("status", $row['status']);
$newnode->setAttribute("photo1", $row['photo1']);
$newnode->setAttribute("photo2", $row['photo2']);
$newnode->setAttribute("photo3", $row['photo3']);
$newnode->setAttribute("photo4", $row['photo4']);
$newnode->setAttribute("photo5", $row['photo5']);
$newnode->setAttribute("photo6", $row['photo6']);
}
echo $dom->saveXML();
?>
Tag : PHP
|
ประวัติการแก้ไข 2012-01-28 21:20:38
|
 |
 |
 |
 |
Date :
2012-01-28 21:19:25 |
By :
raptor |
View :
1423 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |