I am trying to query a SQLite DB and dump the result to xml. Here is the code:
$db = new SQLite3("terrapin");
$db->exec($insert);
$select = "select * from information";
$results=$db->query($select);
while($result=$results->fetchArray(SQLITE3_ASSOC))
{
$xml.="<username>".$result['username']."</username>\n";
$xml.="<latitude>".$result['latitude']."</latitude>\n";
$xml.="<longtitude>".$result['longtitude']."</longtitude>\n";
$xml.="<timestamp>".$result['timestamp']."</timestamp>\n";
$xml.="<filename>".$result['filename']."</filename>\n";
}
When I do a print_r($xml), PHP prints out all values but does not show tags. I am trying to use the code from here. What am I missing?
Because tags is interpreted as html tags so you wont see them, view source to see them.
What you need to do is provide
And send correct response headers to browser that its xml to HTML
Also you are missing root element.