|
Posted by caine on 02/04/07 14:26
I'm currently working on creating the xml feed since I had data ready
in my database after web data extraction. However, it has errors for
this line:
<xml version="1.0" encoding="ISO-8859-1">
I was unable to solve this.
<html>
<head>
<title>MMU RSS FEED</title>
</head>
<body>
header("Content-type: application/xml");
<xml version="1.0" encoding="ISO-8859-1">
<rss version ="2.0">
<channel>
<title>MMU RSS FEED Today: <?php echo date("D, d-M-Y H:i:s")?></
title>
<link>http://bulletin.mmu.edu.my/</link>
<description>MMU RSS FEED</description>
<ttl>60<ttl>
<?php
//connect to database
$db = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("bulletin", $db) or die(mysql_error());
$day = date("Y-n-j");
//select queries
$sql = "SELECT * FROM `bul_data` WHERE `DATE` LIKE '{$day}%' ORDER by
`DEPARTMENT`";
echo "sql=".$sql;
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res)>0)
{
while($row=mysql_fetch_assoc($res))
{
$date = $row['DATE'];
$title = $row['TITLE'];
$department = $row['DEPARTMENT'];
$link = $row['LINK'];
//output to browser
echo "<item>";
echo "<title>$title</title>";
echo "<category>$department</category>";
echo "<link><a href=\"$link\">$link</a></link>";
echo "</item>";
}
echo "</table>";
}
?>
</channel>
</rss>
</body>
</html>
Navigation:
[Reply to this message]
|