dsvjw20866 2009-06-08 10:08
浏览 39

PHP RSS没有在第55行解析

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.


All I am receiving is parse error on line 52 and if I alter it I get parse error on line 55 .. no reason as to the error, but I have noticed the code section isn't recognising it as php in this post. Sorry I can't offer anything further.

  • 写回答

1条回答 默认 最新

  • dongnao2582 2009-06-08 10:20
    关注

    In line 20 you open an if block, in line 34 you open a for loop, but the only place you close something is in line 49. You forgot to close one of the blocks.

    评论

报告相同问题?

悬赏问题

  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上