English 中文(简体)
仓库储存许可证——可以收回记录,以便归还。
原标题:Store Locator Example - can t get records to be returned

我想知道有人是否能够帮助我。 我试图通过谷歌开发商现场展示的榜样,学习如何建造一个储存掩体和Im。

我将记录添加到我的数据库中,并建立了超文本格式,但我只能拿到文件箱,即没有记录归还。

<?php  
require("phpfile.php");

// Get parameters from URL
$center_lat = $_GET["lat"];
$center_lng = $_GET["lng"];
$radius = $_GET["radius"];

// 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 ("hostname", $username, $password);
if (!$connection) {
  die("Not connected : " . mysql_error());
}

// Set the active mySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
  die ("Can t use db : " . mysql_error());
}

// Search the rows in the markers table
$query = sprintf("SELECT address, name, lat, lng, ( 3959 * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance <  %s  ORDER BY distance LIMIT 0 , 20",
  mysql_real_escape_string($center_lat),
  mysql_real_escape_string($center_lng),
  mysql_real_escape_string($center_lat),
  mysql_real_escape_string($radius));
$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("name", $row[ name ]);
  $newnode->setAttribute("address", $row[ address ]);
  $newnode->setAttribute("lat", $row[ lat ]);
  $newnode->setAttribute("lng", $row[ lng ]);
  $newnode->setAttribute("distance", $row[ distance ]);
}

echo $dom->saveXML();
?>

现在我一直在研究这个问题,我可以看一看我哪儿错了。 也许有人会问这个问题,让我知道我会错过什么地方。

很多人

最佳回答

我仅比较了你对我所发申请的非常相似的提问。 除你变量上的单一引文外,所有东西都是一样的:center_lat, Centre_lng, radius

因此,如果假设这些变量是正确的,就应当解决你们的问题。

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签