Tips Station Asp.net Article Seo Articles
Tutorials Code Samples
›  Home
›  Mission
›  About us
›  Contact Us
›  Feedback
›  Terms & Condition
Asp Articles
IT Solutions
 
› ASP.NET

› Programming Tips

› Ajax

› Asp

› ADO.NET

› Databases

› SEO

› CSS And Designing

› Php

 
Most Viewed Articles
 
› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Change theme dynamically without page refresh in ASP.NET

› Simple ASP Image Resize Function

› Install AJAX On Machines Running Visual Studio 2005

› ASP.Net Interview Questions And Their Answers

› Creating Pretty Popups Using AJAX

› Encode Url using ASP

› SQL Server Performance Counters

› .NET Data Access Performance Comparison

› UpdatePanel control in Asp.net Ajax

more...
 
 
Home> Php
 
Make An RSS Feed Using PHP
 

Ok you start off with just finding out the basic structure of a RSS feed channel. So you still have to include title, link, and description to each item you would like to display in your feed.

So the best way to learn how a RSS feed works is by looking at one and seeing were everything should go so take a look at the code below we provided for you and you can understand how it all works.

<?xml version='1.0'?>
<rss version='2.0'>
<channel>
<title>Websites Tittle/Name</title>
<link>Websites full URL</link>
<description>Website description</description>
<language>en-us</language>

<item>
<title>Items Title</title>
<link>Items URL goes here</link>
<description>Items description here</description>
</item>

</channel>
</rss>

Then once you have worked our how the basics of an RSS feed works we then will have to open up a new black page and start loop some PHP coding into it so it will then pick up our database information.

So I have broken the code up for you so I can also explain each step and what parts you have to change.

<?php
$connection = mysql_connect("localhost",
"db_accountname",
"password");
mysql_select_db("db_name", $connection);

Above we have started with connecting to the database. You will have to edit 3 areas in here, the db_accountname, password and db_name.

Then we move onto the SQL query and how many items we would like to display with putting the command ‘LIMIT 10’. You can change this to as much as you would like your feed to show.

$select = "SELECT * FROM db_tablesnamehere ORDER BY id DESC LIMIT 10";
$query = mysql_query($select) or die(mysql_error());

And now we will finish off the code with all the page information. This part it pretty easy so just copy this code below and edit all the areas such as the title, link and description. Also remember don’t forget to keep the $ in front of the database areas or it wont be able to pick up the information.

header("Content-type: text/xml");

echo "<?xml version='1.0'?>
<rss version='2.0'>
<channel>
<title>Websites Tittle/Name</title>
<link>Websites full URL</link>
<description>Website description</description>
<language>en-us</language>";

while($array = mysql_fetch_array($query)){
extract($array);
$content = htmlentities($content);
echo "<item>
<title>$titlehere</title>
<link>$urlhere</link>
<description>$descriptionhere</description>
</item>";
}
echo "</channel></rss>";
?>

When just save this file as a PHP formal and upload it.

 
 
Vrp Technologies
 
Serversea Hosting
 
 
Latest Articles
 
› Sending SMS With PHP

› MySQL Join Tutorial

› Make An RSS Feed Using PHP

› Intro To Object: Option Variables

› Design An Online Chat Room With PHP And MySQL

› Create Tell A Friend Script With HTML & PHP

› Benchmark And Optimize PHP Script Speed

› What Kind of DBA Are You?

› SQL Server Performance Counters

› SQL Server Performance Tips

more...
 
Random Articles
 
› How My Page Rank Went From 0 To 5 In One Update

› How to export a GridView to Excel - Asp.net

› Understanding VARCHAR(MAX) In SQL Server 2005

› Design An Online Chat Room With PHP And MySQL

› Creating Pretty Popups Using AJAX

› Cache Data within your Application - Asp.Net

› UpdatePanel control in Asp.net Ajax

› Get Environment Details - Asp.Net

› .NET Data Access Performance Comparison

› Read and display a text file in Asp.net

more...
 
Home Mission About us Contact us Feedback Terms Conditions
2008 © Copyright TipsStation. All rights reserved.