Hi I wonder if anyone can help with this code. I am trying to show the records from a URL table for a category, eg url_category_id = to 1. where the url and category is the same in the associating table. I am having some issues with this rss as it has a parse error on line 55. I have tried to resolve the issue but without avail.
<?php $db = new mysqli("Host", "USER", "PW", "DB");?>
<?php header('Content-type: text/xml'); ?>
<?php echo "<?";?>xml version="1.0" encoding="iso-8859-1"<?php echo "?>";?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>My TITLE</title>
<description>My DESCRIPTION</description>
<link>www.MyWeb</link>
<copyright>C) 2009 All Rights Reserved</copyright>
<atom:link href="http://source of feed" rel="self" type="application/rss+xml" />
<?php
$query = 'SELECT * FROM url_categories WHERE url_category_id= $type';
$result = mysql_query ($query);
if (isset($_GET['type'])) {
$type = (int) $_GET['type'];
} else {
$type = 3;
}
if ($type > 0) {
// Get the current type name.
$query = "SELECT category FROM url_categories WHERE url_category_id=$type";
$result = mysql_query ($query);
list ($category) = mysql_fetch_array ($result, MYSQL_NUM);
$first = TRUE; // Initialize the variable.
// Query the database.
$query = "SELECT u.url_id, url, title, description, pub_date, STR_TO_DATE(pub_date, '%d-%b-%Y') AS sortdate, DATE_FORMAT(STR_TO_DATE(pub_date, '%d-%b-%Y'), '%d.%b.%Y') FROM urls AS u, url_associations AS ua WHERE u.url_id = ua.url_id AND ua.url_category_id=$type AND ua.approved = 'Y'ORDER BY sortdate DESC";
$result = mysql_query ($query);
$num_records = mysql_num_rows($result);
$number = $results->num_rows;
for ($i = 1; $i <= $number; $i++) {
$row = $results->fetch_assoc();
$title = $row['title'];
$description = $row['description'];
$url = $row['url'];
$date = $row['sortdate'];
?>
<item>
<title><?php echo $title; ?></title>
<description><?php echo $description; ?></description>
<link><?php echo "http://";?><?php echo $url; ?></link>
<guid><?php echo "http://";?><?php echo $url; ?></guid>
<pubDate><?php echo date("D, d M Y H:i:s O", strtotime($date)); ?></pubDate>
</item>
<?php
}
?>
</channel>
</rss>
<?php
$db->close();
?>//This is the parse error line
I would be grateful for any assistance in trying to resolve this issue.
Kind regards,
Sean