Jump to content

database driven dynamic xml errors


Lodius2000

Recommended Posts

hi guys, first time dealing with xml (im modifying an ajax tutorial i found)

 

ok heres the xml document

<?php
header('Content-Type: text/xml');
require_once ('../../PEAR/PEAR/DB.php');
require_once ('../../storeoutofaccess/db_login.php');
require_once ('../../storeoutofaccess/settings.php');
$db->setErrorHandling(PEAR_ERROR_DIE);
$db->setFetchMode(DB_FETCHMODE_ASSOC);



print '<?xml version="1.0"?>' . "\n";
print "<pages>\n";

$rows = $db->query('SELECT username FROM users ORDER BY username');

foreach($rows as $row){
print "<link>\n";
print "<title>" . $row[username] . "</title>\n";
print "<url>singleuser.php?username=" . $row[username] . "</url>\n";
print "</link>\n";
}

print "</pages>\n";

?>

 

as you can see I use pear db, I am SURE the sql is valid, anyway, with this im getting this error when I try to view the document in browser

XML Parsing Error: not well-formed
Location: http://www.example.com/search/links.xml
Line Number 14, Column 21:
$rows = $db->query('SELECT username FROM users ORDER BY username');
--------------------^

 

just to be sure that error is on the 'S' in SELECT

 

whats the problem

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/146455-database-driven-dynamic-xml-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.