-
Notifications
You must be signed in to change notification settings - Fork 1
/
2g_markers_pku.php
57 lines (48 loc) · 1.51 KB
/
2g_markers_pku.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
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require("phpsqlajax_dbinfo.php");
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;
}
// 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 a.*, b.* FROM 2g_siteID_PKU_ceklist a LEFT JOIN v2gcoloinfo_pku b ON b.2gsiteid = a.siteid";
$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['sitename']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo 'region="' . $row['regional'] . '" ';
echo 'status="' . $row['status'] . '" ';
echo 'siteid="' . $row['siteid'] . '" ';
echo 'sys="' . $row['band'] . '" ';
echo 'colo3g="' . $row['3gcolo'] . '" ';
echo 'colo4g="' . $row['4gcolo'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
?>