RSS reader/RSS display with PHP

Posted: January 19, 2011 in PHP5
Tags:

<?php header(“Content-type: text/xml”); ?>
<?php echo “<?xml version=\”1.0\” encoding=\”UTF-8\”?>”; ?>
<rss version=”2.0″>
<channel>

<title>Website Title Here</title>

<?php
require_once(“controller/dbconfig.php”); //change database configuration file
$con=new data(); //change class name and put your class
$connect=$con->connect(); //change function name and put your class

$query = “select * from video1 where status=’2′ order by date desc limit 5”; //change the query
$result=$con->execute($query);

while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}

?>
<?php foreach ($return as $item) { ?>

<item>
<title><?php echo htmlentities($item[‘v_name’]); ?></title> <!–Change table column name.[v_name] –>
<?php $id=$item[‘id’]; ?> <!–Change table column name.[id] –>
<link><?php echo “http://yoursite.com/video.php?id=$id&#8221;; ?></link>
<description>
<![CDATA[
<table width=”80%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=20%>
<img src=”<?php echo htmlentities($item[‘images’]); ?>” width=”80″ height=”80″ /> <!–Change table column name.[images] –>
</td>
<td width=80% valign=top><?php echo htmlentities($item[‘description’]);?></td> <!–Change table column name.[description] –>
</tr>

</table>

]]></description>
</item>

<?php } ?>

</channel>
</rss>

Advertisements
Comments
  1. Great blog. I was checking continuously this blog and I am quite impressed! Very helpful info specifically the first part. I care for such information a lot. I was looking for this certain info for a long time. Thank you and good luck.

  2. Excellent blog. I was checking continuously this blog and I am impressed! Extremely useful information particularly the first part. I care for such information much. I was seeking this particular information for a very long time. Thank you and good luck.

  3. Micah Peavy says:

    Amazing article. I was checking continuously this blog and I am quite impressed! Very useful information particularly the first part. I care for such information a lot. I was looking for this certain info for a very long time. Thank you and best of luck.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s