Hallo und Danke Florian,
die Hinweise werde ich wenn es dann mal klappt berücksichtigen. Bei Google wird die Nutzung der Api ja sehr gut beschrieben. Ich hatte mir nun gedacht die Erstellung des XML Files mit meiner mysql Abfrage in der Codesection zu erledigen, nach Google erfolgt das ja in einer seperaten .php, und bin kläglich gescheitert. Der Aufruf von
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['firma']) . '" ';
echo 'address="' . parseToXML($row['ort']) . '" ';
echo 'telefon="' . parseToXML($row['telefon']) . '" ';
echo 'lat="' . $row['Lat'] . '" ';
echo 'lng="' . $row['Lon'] . '" ';
echo 'type="' . $row['plz'] . '" ';
echo '/>';
}
bring kein Ergebnis, ich glaub es was mit "header("Content-type: text/xml");" innerhalb der Codesection zu tun, weil ausserhalb in einer seperaten Datei geht es ja den XML File zu erstellen.
Wenn ich wüsste wie ich meine mySQl Ergebnisse aus der Abfrage, innerhalb der Codesection, an die seperate Datei übergeben kann wäre das ja auch eine Möglichkeit.
Google erstellt das XML File so:
<?php
require("phpsqlajax_dbinfo.php");
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",'&#39;',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
// Opens a connection to a MySQL server
$connection=mysql_connect (localhost, $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());
}
// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['name']) . '" ';
echo 'address="' . parseToXML($row['address']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo 'type="' . $row['type'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
?>
Wie kann ich meine Abfrage (Ergebnisse) anstelle der Google while Schleife übergeben. Irgendwie stehe ich im Augenblick voll auf dem Schlauch
