RSS Feed using PHP/MySQL errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Trying to create an articles rss feed for my site and I keep getting an
error that says:

=====
A semi colon character was expected.
Line: 7 Character: 60
<link>http://www.chirunning.com/shop/pages.php?pageid=19&id=383</link>
=====

I've tried every way imaginable to figure out why I am getting this error,
finally I needed to post it to get some feedback. I put an ARROW at the end
of the line in question below. Thanks in advance for any insight you can
provide.

<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

// Set RSS version.
echo "<rss version=\"2.0\"> ";

// Start the XML.
echo "
<channel>
<title>Articles Feed</title>
<description>Latest Articles</description>
<link>http://www.mydomain.com/shop/pages.php?pageid=17</link>";

// Create a connection to your database.
//require("db_connection.php");

@mysql_connect('localhost', 'xxxxx', 'xxxxx') or die('ERROR--CAN'T CONNECT
TO SERVER');
@mysql_select_db('shop') or die('ERROR--CAN'T CONNECT TO DB');

$masterQuery="SELECT articleid, the_date, title FROM mytable WHERE type = 1
ORDER BY the_date DESC";


// Query database and select the last 10 entries.
$data = mysql_query($masterQuery);
while($row = mysql_fetch_array($data))
{

// Convert database images data into actual image link.
$row[Intro] = str_replace("images/", "http://www.mydomain.com/images/";,
$row[Intro]);

// Continue with the 10 items to be included in the <item> section of the
XML.
echo "
<item>
<link>http://www.mydomain.com/shop/pages.php?pageid=19&id=".$row[articleid].";</link>
<!---ERROR!
<guid isPermaLink=\"true\">
http://www.mydomain.com/shop/pages.php?pageid=18&id=
".$row[articleid]."</guid>
<title>".$row[chi_title]."</title>
</item>";
}

// substr can limit the number of characters. First number is starting point
while the second number is number of characters.
// otherwise just use $row[Intro].
// <guid> is an optional sub-element of <item> but recommended if you don't
want to receive a warning when validating your RSS.
echo "</channel></rss>";
?>

DM

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux