Quantcast
Channel: amitmondal
Viewing all articles
Browse latest Browse all 10

RSS reader/RSS display with PHP

$
0
0

<?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”; ?></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>



Viewing all articles
Browse latest Browse all 10

Trending Articles