Ich bin seit einer Woche mit diesem Fehler festgefahren, habe gegoogelt und jede mögliche Lösung einschließlich der auf Stackoverflow versucht. Dies ist mein Code:Überprüfen, ob XML-Ausgabe funktioniert
<?php
require("phpsqlsearch_dbinfo.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=mysqli_connect ("localhost", $username, $password);
if (!$connection) {
die("Not connected : " . mysqli_error());
}
// Set the active mySQL database
$db_selected = mysqli_select_db($connection, $database);
if (!$db_selected) {
die ("Can\'t use db : " . mysqli_error($connection));
}
// Search the rows in the markers table
$query = sprintf("SELECT id, name, address, 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",
mysqli_real_escape_string($connection, $center_lat),
mysqli_real_escape_string($connection, $center_lng),
mysqli_real_escape_string($connection, $center_lat),
mysqli_real_escape_string($connection, $radius));
$result = mysqli_query($connection, $query);
$result = mysqli_query($connection, $query);
if (!$result) {
die("Invalid query: " . mysqli_error($connection));
}
header("Content-type: text/xml");
// Iterate through the rows, adding XML nodes for each
while ($row = @mysqli_fetch_assoc($result)){
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("id", $row['id']);
$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();
?>
Mein Ziel ist die XML an den Browser ausgeben, um sicherzustellen, dass es funktioniert, aber ich habe diesen Fehler wurde immer:
Für weitere Informationen siehe: https://developers.google.com/maps/solutions/store-locator/clothing-store-locator Kann jemand hilft mir aus ???
Sie sollten Ihren Code richtig einrücken. Es hilft jedem, Ihren Code zu lesen, und es ist auch gut für Sie. – ryantxr
Können Sie Ihre XML-Ausgabe einfügen? Das ist eine Browser-Nachricht, keine PHP-Fehlermeldung – delboy1978uk
@ delboy1978uk meine XML-Ausgabe ist das Bild – sankareb