ok.. below is the code.. the file is named feed.rss and i have allowed via htaccess rss to include php code
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>..</title>
<description>..</description>
<lastBuildDate>..</lastBuildDate>
<language>en-us</language>
<?php
$dbh=mysql_connect ("localhost", "DBuser", "password")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("mDB");
$postCount = "23";
//read information in Post table cells
do {
$queryPost = "SELECT * FROM blog";
$resultPost = mysql_query($queryPost) or die("Post Query failed");
while ($linePost = mysql_fetch_array($resultPost, MYSQL_ASSOC)) {
if($linePost[id] == $postCount) {
$postCount--;
?>
<item>
<title><?php echo $linePost[title]; ?></title>
<pubDate><?php echo $linePost[date]; ?></pubDate>
<description><![CDATA[<?php echo $linePost[body]; ?>]]></description>
</item>
<?php
}
}
}while($postCount > 0);
?>
</channel>
</rss>
the error that i am getting is
Parse error: syntax error, unexpected T_STRING in /home/chad1/public_html/feed.rss on line 1
i have also tried using php to write the first line as below.
<?php
echo "<?xml version="1.0" encoding="UTF-8" \?>";
?>
and
<?php
echo "<?xml version="1.0" encoding="UTF-8" /?>";
?>
but still i can't figure out how to get that to display correctly.
thanks for the quick reply.
chad