-
Notifications
You must be signed in to change notification settings - Fork 3
/
geocode_genxml_customers.php
45 lines (35 loc) · 1.17 KB
/
geocode_genxml_customers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/* $Id$*/
$title = _('Geocode Generate XML');
include ('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
$sql = "SELECT * FROM custbranch WHERE 1";
$ErrMsg = _('An error occurred in retrieving the information');;
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_array($result);
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($myrow = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($myrow['brname']) . '" ';
echo 'address="' . parseToXML($myrow["braddress1"] . ", " . $myrow["braddress2"] . ", " . $myrow["braddress3"] . ", " . $myrow["braddress4"]) . '" ';
echo 'lat="' . $myrow['lat'] . '" ';
echo 'lng="' . $myrow['lng'] . '" ';
echo 'type="' . $myrow['type'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
?>