-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_xml.php
More file actions
30 lines (26 loc) · 889 Bytes
/
Copy pathtest_xml.php
File metadata and controls
30 lines (26 loc) · 889 Bytes
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
<?php
include("inspection_class.php");
include("include.php");
$con = mysql_connect($mysql_host,$mysql_user,$mysql_password);
mysql_select_db($mysql_database,$con);
$query = "SELECT * FROM inspections WHERE latitude IS NULL AND longitude IS NULL ORDER BY policy";
$result = mysql_query($query);
$xml = '<?xml version="1.0" encoding="UTF-8" ?><inspections>';
while($row = mysql_fetch_array($result))
{
$xml .= "<inspection>";
$xml .= "<policy>$row[policy]</policy>";
$xml .= "<name>$row[name]</name>";
$xml .= "<name2>$row[name2]</name2>";
$xml .= "<address>$row[address]</address>";
$xml .= "<address2>$row[address2]</address2>";
$xml .= "<cityst>$row[cityst]</cityst>";
$xml .= "</inspection>";
}
$xml .= "</inspections>";
$xmlfile = "testfile.xml";
$FileHandle = fopen($xmlfile,'w');
fwrite($FileHandle, $xml);
fclose($FileHandle);
echo $xml;
?>