Jump to content

RSS feed


tour93

Recommended Posts

Posted

Hello,

I tried to create a RSS feed on my site with php and mysql.

<?php

header("Content-Type: application/rss+xml; charset=ISO-8859-1");

require_once ('mysql_connect.php');

$rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>';

$rssfeed .= '<rss version="2.0">';

$rssfeed .= '<channel>';

$rssfeed .= '<title>My RSS feed</title>';

$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)

or die('Could not connect to database');

mysql_select_db(DB_NAME)

or die ('Could not select database');

$query = "SELECT * FROM rsstable";

$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {

extract($row);

$rssfeed .= '<item>';

$rssfeed .= '<link>' . $row['url'] . '</link>';

$rssfeed .= '</item>';

}

$rssfeed .= '</channel>';

$rssfeed .= '</rss>';

echo $rssfeed;

?>

I set up Utorrent to download the feed but it cannot see anything.

What is wrong with the feed?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...