大家好,我试图用动态的位置从数据库中检索,我下面显示谷歌地图上phpsqlajax_v3 developers.google.com/maps/articles。我创建的数据库和表看起来像这样
运输公共表
transportpublicid int 11 AUTOINCREMENT
运输类型 varchar 60
costPerKm 十进制(7,2)
地址 varchar 800
电话号码 int 10
webLink varchar 300
描述 varchar 800
纬度双(10,6)
lng double(10,6)
生成Xml.php
<?php
require("db_connection.php");
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr); // line 11
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
// Select all the rows in the markers table
$query = "SELECT transportType,costPerKm,address,teleNo,webLink,lat,lng FROM transportpublic";
$result = mysql_query($query);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo …Run Code Online (Sandbox Code Playgroud)