Reputation: 3797
I have a dynamically generated XML file that is working great except for the RSS generated is written out as & in the
Sample URL: http://tinyurl.com/bbhnpg6
Actual Working URL that http://tinyurl.com/crbuny5
How do I properly escape the $URL variable so that it properly writes the &? Can someone show this sample updated properly please?
// selecting data from "mytable"
// mytable = your article table name
$query = @mysql_query("SELECT * FROM TABLE1 ORDER BY EntryDate ASC LIMIT 0,5");
while($row = @mysql_fetch_array($query)){
// [title] = change it to your article title
$title = $row['MLNumber'];
$link = $row['ListingRid'];
$url = "http://www.domain.com/residential?frame=TAL&MLNO=";
$Unit= $row['Unit'];
$City= $row['City'];
$ZipCode= $row['ZipCode'];
$price = $row['SearchPrice'];
$description = $row['MarketingRemarks'];
$SubdivisionDisplay = $row['SubdivisionDisplay'];
echo '<item>';
echo '<title>' . $Unit . ' ' . $City . ', ' . $ZipCode . ' -' . $SubdivisionDisplay . '</title>';
echo '<link>' . $url . '' . $title . '</link>';
echo '<description><![CDATA[<p><strong>$' . $price . '.00</strong><BR> ' . $description . '<BR> ]]></description>';
//echo '<pubDate>' . date("D, d M Y H:i:s O", time()) . '</pubDate>';
echo '</item>';
}
echo '</channel>';
echo '</rss>';
?>
Upvotes: 0
Views: 191