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>
When you are opening the
<item>tag, you have an extra quote...Should be
This would through out the quoting of data cause all sorts to be combined.