I have a fairly simple php file that attempts to create an XML document. I am trying to get the URLs pulled from the mysql database to show up in the XML document that i create.
I cannot seem to figure out why my url's are ignored without xlink information. That is the mysql database is accessed successfully but only the title and description information is created in the xml document.
And when I add the xlink information the document simply gives no output at all. The code is below.
<?php header('Content-Type: text/xml'); ?>
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<rss version="2.0">
<channel xmlns:xlink="http://www.w3.org/1999/xlink>
<title>METHUZALA.COM</title>
<link xlink:type="simple" xlink:href="http://www.methuzala.com">http://www.methuzala.com</link>
<description>UPDATE: Articles Found and Added</description>
<language> en-us </language>
<?php
require('php/includes/path.php');
$conn= mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );
$query="SELECT title, short_title, article_url, short_description from news_article";
$data = mysqli_query($conn,$query);
while ($row = mysqli_fetch_array($data)) {
echo '<item">';
echo '<title>'. $row['title']. '</title>';
echo '<wurl xlink:type="simple" xlink:href="'.$row['article_url'].'" xlink:show="new">TESTING'.'</wurl>';
echo '<description>'. $row['short_description']. '</description>';
echo '</item>';
} //while-end of file
mysqli_close($conn);
echo '</item>';
?>
</channel>
</rss>
I welcome any input that might be helpful. I removed the xlink information and this code produces a result that is radically different depending on the browser.
In Chrome: It gives the correct rss XML file output, but no newsfeed output.
In Safari: It gives the correct newsfeed output but it is not formatted. it is one large paragraph.
In Firefox: It gives the correct first lines of the channel(Title of the newsfeed, description of the newsfeed, but no links or elements show in the xml output. Elements are all blank.
firefox output safari output