PHP RSS未在第55行解析

PHP RSS未在第55行解析,php,mysql,rss,Php,Mysql,Rss,嗨,我想知道是否有人能帮上这个代码。我试图显示某个类别的URL表中的记录,例如URL\u category\u id=to 1。其中url和类别在关联表中相同。 我对这个rss有一些问题,因为它在第55行有一个解析错误。我曾试图解决这个问题,但无济于事 <?php $db = new mysqli("Host", "USER", "PW", "DB");?> <?php header('Content-type: text/xml'); ?> <?php echo

嗨,我想知道是否有人能帮上这个代码。我试图显示某个类别的URL表中的记录,例如URL\u category\u id=to 1。其中url和类别在关联表中相同。 我对这个rss有一些问题,因为它在第55行有一个解析错误。我曾试图解决这个问题,但无济于事

 <?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

xml version=“1.0”encoding=“iso-8859-1”
我的头衔
我的描述
www.MyWeb
C) 2009版权所有

在第20行中,您打开一个
if
块,在第34行中,您打开一个
for
循环,但您关闭某个对象的唯一位置是在第49行。您忘记关闭其中一个块。

是的,如果出现错误,那就太好了。:)嗨,我注意到了这一点,并在第50行添加了一个闭环。这并没有消除错误,我在第53行尝试了一个额外的循环,但没有成功。谢谢你的帮助。