I am working to display the markers on my website.For this purpose i am getting the data from sqlite3 database. Can you correct me where i am doing wrong?
I am getting this error in wamp server: error on line 1 at column 3: xmlParsePI : no target name
This is my code:
maps.php:
<?php
require("phpsqlajax_dbinfo.php");
// Start XML file, create parent node
$doc = new DOMDocument("1.0");
$node = $doc->createElement ("marker");
$parnode = $doc->appendChild($node);
// Opens a connection to a MySQL server
class MyDB extends SQLite3
{
function __construct()
{
$this->open('mytrip.db');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
}
// Set the active MySQL database
// Select all the rows in the markers table
$query = "SELECT * FROM marker ";
$resultt = $db->query($query);
//if (!$result) {
// die('Invalid query: ' . mysql_error());
//}
header("Content-type: text/xml");
// Iterate through the rows, adding XML nodes for each
while ($row = $ret->fetchArray(SQLITE3_ASSOC)){
// Add to XML document node
$node = $doc->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->set_attribute("city_id", $row['id']);
$newnode->set_attribute("name", $row['name']);
// $newnode->set_attribute("address", $row['address']);
$newnode->set_attribute("latitude", $row['latitude']);
$newnode->set_attribute("longitude", $row['longitude']);
$newnode->set_attribute("type", $row['type']);
}
$xmlfile = $doc->dump_mem();
echo $xmlfile;
?>
phpsqlajax_dbinfo.php
<?
$username="username";
$password="password";
$database="username-databaseName"
?>