Generating a RSS feed by modifying this code: http://www.webreference.com/authoring/languages/xml/rss/custom_feeds/index.html
However I am receiving the following error:
XML Parsing Error: syntax error
Location: http://websitename/rss/index.php
Line Number 2, Column 1:Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /path/rss/classes/RSS.class.php on line 46
^
My code is:
[code]<?php
class RSS
{
public function RSS()
{
require_once (’…/dbAccess.php’);
}
public function GetFeed()
{
return $this->getDetails() . $this->getItems();
}
private function dbConnect()
{
DEFINE (‘LINK’, mysql_connect (HOST, USER, PASSWORD));
}
private function getDetails()
{
$detailsTable = “Table1”;
$this->dbConnect($detailsTable);
$query = "SELECT * FROM ". $detailsTable;
$result = mysql_db_query (DB, $query, LINK);
while($row = mysql_fetch_array($result))
{
$details = ’<?xml version="1.0" encoding="ISO-8859-1" ?>
‘. $row[‘type’] .’
‘. $row[‘weekdate’] .’
‘. $row[‘r’] .’
‘. $row[‘start’] .’
‘. $row[‘end’] .’
‘. $row[‘average’] .’
‘. $row[‘frequent’] .’
}
return $details;
}
private function getItems()
{
$itemsTable = “Table2”;
$this->dbConnect($itemsTable);
$query = "SELECT * FROM ". $itemsTable;
$result = mysql_db_query (DB, $query, LINK);
$items = ‘’;
while($row = mysql_fetch_array($result))
{
$items .= ’
‘. $row[‘type’] .’
‘. $row[‘weekdate’] .’
‘. $row[‘r’] .’
‘. $row[‘start’] .’
‘. $row[‘end’] .’
‘. $row[‘average’] .’
‘. $row[‘frequent’] .’
';
}
$items .= '</channel>
</rss>';
return $items;
}
}
?> [/code]
Can you advise why this is happening?