SlideShare a Scribd company logo
PHP/MySQL RSS Feed
Php Mysql Feedrss
	If you have a web site that is database driven with regularly updated material then it may be a good idea to setup an RSS feed for your website. This tutorial assumes you have a basic understanding of PHP and MySQL — otherwise how else did you get a database driven web site?
The first step is to use PHP to declare an XML document.
<?phpheader(“Content-type: text/xml”);echo“<?xml version=\”1.0\” encoding=\”UTF-8\”?>”;	The ‘header’ sets the HTTP header to text/xml so the client (RSS reader) knows that the content-type is XML. The rest of the PHP sets the document type as XML version 1.0. The next step is to set the RSS version.
// Set RSS version.echo“<rss version=\”2.0\”>”;	Just in case you’re wondering why there is a line break after the ‘echo “’, it is to make the XML document code neater when it’s generated. The same system is used throughout this tutorial.
Next, we can begin to create the actual XML ocument.
// Start the XML.echo“   <channel>        <title>Feed title</title>        <description>A description of the feed contents</description>        <link>http://www.yoursite.com/</link>”;	What the above code does is create the opening ‘<channel>’ tag as well as the required ‘<title>’, ‘<description>’ and ‘<link>’ elements.
	Once the start of the document has been setup, it’s time to get the data that will fill the XML document from the database. I have a PHP file created that I use for all my database connections that I link to using the following.// Create a connection to your database.require(“db_connection.php”);
	The code that you would find on that page would be like this:<?phpmysql_connect(‘server’, ‘username’, ‘password’) or die(‘ERROR--CAN’T CONNECT TO SERVER’);mysql_select_db(‘database_name’) or die(‘ERROR--CAN’T CONNECT TO DB’);?>	The first line (‘mysql_connect...’) connects to the server while the second line (‘mysql_select_db...’) connects to your database. You need to replace the relevant information with your own server/database details for this to work.
Now we can begin to add the data that gets pulled from the database.
// Query database and select the last 10 entries.$data = mysql_query(“SELECT * FROM table ORDER BY id DESC LIMIT 10”);while($row = mysql_fetch_array($data)){	/* Convert database images data into actual image link. */	$row[Intro] = str_replace(“images/”, “http://www.yoursite.com/images/”,$row[Intro]);
	What we have done now is query the database and selected everything from the table named ‘table’ but limited the results to the last 10 (ordered latest to oldest by their id). You would need to edit ‘table’ to the name of the table you want to create a feed fom.	‘$row[Intro]’ assumes you have a column in your table called ‘Intro’. You would need to rename this to whatever the column name is that contains the data you want to have displayed in the RSS reader.	The str_replace function replaces all instances of ‘images/’ with ‘http://www.yoursite.com/images/’ which is very important if the column you are getting data from in your database contains links to images on your site. If this is not the case, feel free to ignore that line of code. And if you have a different location for your images, edit accordingly.
The next part is where the XML document is filled with data.
/* Continue with the 10 items to be included in the <item> section of the XML. */echo“   <item>	<link>http://www.yoursite.com/article.php?id=”.$row[id].”</link>	<guid isPermaLink=\”true\”>http://www.yoursite.com/article.php?id=”.$row[id].”</guid>	<title>”.$row[Title].”</title><description><![CDATA[“.$row[Intro].”]]></description>	<comments>http://www.yoursite.com/article.php?id=”.$row[id].”#Comments</comments>	</item>”;}
	The code above creates the ‘<item>’ and its required ‘<link>’, ‘<title>’ and ‘<description>’ elements. I have also included the ‘<guid>’ element as it is recommended by the Feed Validator. The ‘<guid>’ element uniquely identifies the item. In my case, the link URL is always unique and therefore works well as the ‘<guid>’. If the link to the article will always remain the same, then set ‘isPermaLink’ to ‘true’. If the URL will change, set it to ‘false’. You will need to edit the ‘<link>’ and ‘<guid>’ elements to display whatever web pages your site uses.	The contents of the ‘<link>’ element contain the URL of the full document you are linking to. ‘<title>’ displays the title of the document (if your title field is not named ‘Title’ then rename ‘$row[Title]’ to suit your database).
	The ‘<description>’ element contains the text from the article that you want to have displayed in the RSS reader. An important part of this element’s contents is the CDATAsection. Normally, XML parses all of the text contained within it. So if your text contains characters like ‘<’ or ‘&’ then your description will be broken. If you plan on including images in your feed, then you’ll need to include the CDATA code.
	If the text you are including in your description can be very lengthy you may also want to consider using ‘substr’. So instead of displaying ‘<description><![CDATA[“.$row[Intro].”]]></description>’ you would show ‘<description> <![CDATA[“.substr($row[Intro],0,150).”]]></description>’. What the substr code does is start from the first character (represented by the ‘0’) and counts to the 150th character (represented by the ‘150’). Anything after the 150th character is not displayed. Again, feel free to change the ‘150’ to any number that suits your needs.
	Finally, another optional element I have included is the ‘<comments>’ element. IftheURL of your articl e allows for comments you can include a link to where the comments can be found.	To get a full description of all the different tags available in RSS, check http://feedvalidator.org/docs/.	All that is left to do now is close the ‘<channel>’ element and RSS document using PHP.
echo“</channel></rss>”;?>	You have now created an XML document/RSS feed. I have included the completed code on the following page. Please note, this tutorial does contain formatted text which you will need to replace if you plan on copying and pasting it into a program like Dreamweaver. Code such as “ and ” will have to be replaced (use Ctrl+Fin Dreamweaver to replace the text) so that it becomes unformatted.
<?phpheader(“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>Feed title</title><description>A description of the feed contents</description><link>http://www.yoursite.com/</link>”;// Create a connection to your database.
require(“db_connection.php“);// Query database and select the last 10 entries.$data = mysql_query(“SELECT * FROM table ORDER BY id DESC LIMIT 10”);while($row = mysql_fetch_array($data)){// Convert database images data into actual image link.$row[Intro] = str_replace(“images/”, “http://www.yoursite.com.au/images/”, $row[Intro]);// Continue with the 10 items to be included in the <item> section of the XML.
echo “<item><link>http://www.yoursite.com/article.php?id=”.$row[id].”</link><guid isPermaLink=\”true\”>http://www.yoursite.com/article.php?id=”.$row[id].”</guid><title>”.$row[Title].”</title><description><![CDATA[“.$row[Intro].”]]></description><comments>http://www.yoursite.com/article.php?id=”.$row[id].”#Comments</comments></item>”;}
// substr can limit the number of characters. First number is starting point while the second number is number ofcharacters.// otherwise just use $row[Intro].// <guid> is an optional sub-element of <item> but recommended if you don’t want to receive a warning whenvalidating your RSS.echo“</channel></rss>”;?>
Php Mysql Feedrss

More Related Content

What's hot (12)

Internet with HTML
Internet with HTML
umesh patil
 
Html (hypertext markup language)
Html (hypertext markup language)
Anuj Singh Rajput
 
Hyperlink
Hyperlink
Bhavesh Solanki
 
Html links
Html links
eShikshak
 
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
techlovers3
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchors
Grayzon Gonzales, LPT
 
Forms and Databases in PHP
Forms and Databases in PHP
Mike Crabb
 
Just Enough HTML for Fatwire
Just Enough HTML for Fatwire
Kenneth Quandt
 
ASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
Xml For Dummies Chapter 4 Adding Xhtml For The Web
Xml For Dummies Chapter 4 Adding Xhtml For The Web
phanleson
 
LINKING IN HTML
LINKING IN HTML
Varsha Dubey
 
JSON and REST
JSON and REST
Robert MacLean
 
Internet with HTML
Internet with HTML
umesh patil
 
Html (hypertext markup language)
Html (hypertext markup language)
Anuj Singh Rajput
 
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
techlovers3
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchors
Grayzon Gonzales, LPT
 
Forms and Databases in PHP
Forms and Databases in PHP
Mike Crabb
 
Just Enough HTML for Fatwire
Just Enough HTML for Fatwire
Kenneth Quandt
 
ASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
Xml For Dummies Chapter 4 Adding Xhtml For The Web
Xml For Dummies Chapter 4 Adding Xhtml For The Web
phanleson
 

Similar to Php Mysql Feedrss (20)

Php Rss
Php Rss
mussawir20
 
RSS Application Using Dom
RSS Application Using Dom
abdullah roomi
 
How to create rss feed
How to create rss feed
Tanuja Talekar
 
How to create rss feed for your website
How to create rss feed for your website
OM Maurya
 
Creating an RSS feed
Creating an RSS feed
Karthikeyan Mkr
 
Mla Databases
Mla Databases
Robin Hastings
 
Rss feed complete guide
Rss feed complete guide
somnath_ban
 
Rss feed complete guide
Rss feed complete guide
somnath_ban
 
Sitemap comparison
Sitemap comparison
lukewright418
 
Are you missing out on the RSS revolution?
Are you missing out on the RSS revolution?
Mike Richwalsky
 
Getting Started with RSS
Getting Started with RSS
jenna3
 
RSS Feeder
RSS Feeder
anuradha srivastava
 
Flash templates for Joomla!
Flash templates for Joomla!
Herman Peeren
 
Flash Templates- Joomla!Days NL 2009 #jd09nl
Flash Templates- Joomla!Days NL 2009 #jd09nl
Joomla!Days Netherlands
 
Rss 101
Rss 101
Westerville Library
 
Integrating RSS Into Your Web Site
Integrating RSS Into Your Web Site
Michael Sauers
 
SimpleXML In PHP 5
SimpleXML In PHP 5
Ron Pringle
 
Rss on your_library_site
Rss on your_library_site
peacekaat
 
Rancangan Jaringan Komputer
Rancangan Jaringan Komputer
Candra Adi Putra
 
Integrating RSS into Your Web site
Integrating RSS into Your Web site
Michael Sauers
 
RSS Application Using Dom
RSS Application Using Dom
abdullah roomi
 
How to create rss feed
How to create rss feed
Tanuja Talekar
 
How to create rss feed for your website
How to create rss feed for your website
OM Maurya
 
Rss feed complete guide
Rss feed complete guide
somnath_ban
 
Rss feed complete guide
Rss feed complete guide
somnath_ban
 
Are you missing out on the RSS revolution?
Are you missing out on the RSS revolution?
Mike Richwalsky
 
Getting Started with RSS
Getting Started with RSS
jenna3
 
Flash templates for Joomla!
Flash templates for Joomla!
Herman Peeren
 
Flash Templates- Joomla!Days NL 2009 #jd09nl
Flash Templates- Joomla!Days NL 2009 #jd09nl
Joomla!Days Netherlands
 
Integrating RSS Into Your Web Site
Integrating RSS Into Your Web Site
Michael Sauers
 
SimpleXML In PHP 5
SimpleXML In PHP 5
Ron Pringle
 
Rss on your_library_site
Rss on your_library_site
peacekaat
 
Rancangan Jaringan Komputer
Rancangan Jaringan Komputer
Candra Adi Putra
 
Integrating RSS into Your Web site
Integrating RSS into Your Web site
Michael Sauers
 
Ad

Recently uploaded (20)

Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Ad

Php Mysql Feedrss

  • 3. If you have a web site that is database driven with regularly updated material then it may be a good idea to setup an RSS feed for your website. This tutorial assumes you have a basic understanding of PHP and MySQL — otherwise how else did you get a database driven web site?
  • 4. The first step is to use PHP to declare an XML document.
  • 5. <?phpheader(“Content-type: text/xml”);echo“<?xml version=\”1.0\” encoding=\”UTF-8\”?>”; The ‘header’ sets the HTTP header to text/xml so the client (RSS reader) knows that the content-type is XML. The rest of the PHP sets the document type as XML version 1.0. The next step is to set the RSS version.
  • 6. // Set RSS version.echo“<rss version=\”2.0\”>”; Just in case you’re wondering why there is a line break after the ‘echo “’, it is to make the XML document code neater when it’s generated. The same system is used throughout this tutorial.
  • 7. Next, we can begin to create the actual XML ocument.
  • 8. // Start the XML.echo“ <channel> <title>Feed title</title> <description>A description of the feed contents</description> <link>http://www.yoursite.com/</link>”; What the above code does is create the opening ‘<channel>’ tag as well as the required ‘<title>’, ‘<description>’ and ‘<link>’ elements.
  • 9. Once the start of the document has been setup, it’s time to get the data that will fill the XML document from the database. I have a PHP file created that I use for all my database connections that I link to using the following.// Create a connection to your database.require(“db_connection.php”);
  • 10. The code that you would find on that page would be like this:<?phpmysql_connect(‘server’, ‘username’, ‘password’) or die(‘ERROR--CAN’T CONNECT TO SERVER’);mysql_select_db(‘database_name’) or die(‘ERROR--CAN’T CONNECT TO DB’);?> The first line (‘mysql_connect...’) connects to the server while the second line (‘mysql_select_db...’) connects to your database. You need to replace the relevant information with your own server/database details for this to work.
  • 11. Now we can begin to add the data that gets pulled from the database.
  • 12. // Query database and select the last 10 entries.$data = mysql_query(“SELECT * FROM table ORDER BY id DESC LIMIT 10”);while($row = mysql_fetch_array($data)){ /* Convert database images data into actual image link. */ $row[Intro] = str_replace(“images/”, “http://www.yoursite.com/images/”,$row[Intro]);
  • 13. What we have done now is query the database and selected everything from the table named ‘table’ but limited the results to the last 10 (ordered latest to oldest by their id). You would need to edit ‘table’ to the name of the table you want to create a feed fom. ‘$row[Intro]’ assumes you have a column in your table called ‘Intro’. You would need to rename this to whatever the column name is that contains the data you want to have displayed in the RSS reader. The str_replace function replaces all instances of ‘images/’ with ‘http://www.yoursite.com/images/’ which is very important if the column you are getting data from in your database contains links to images on your site. If this is not the case, feel free to ignore that line of code. And if you have a different location for your images, edit accordingly.
  • 14. The next part is where the XML document is filled with data.
  • 15. /* Continue with the 10 items to be included in the <item> section of the XML. */echo“ <item> <link>http://www.yoursite.com/article.php?id=”.$row[id].”</link> <guid isPermaLink=\”true\”>http://www.yoursite.com/article.php?id=”.$row[id].”</guid> <title>”.$row[Title].”</title><description><![CDATA[“.$row[Intro].”]]></description> <comments>http://www.yoursite.com/article.php?id=”.$row[id].”#Comments</comments> </item>”;}
  • 16. The code above creates the ‘<item>’ and its required ‘<link>’, ‘<title>’ and ‘<description>’ elements. I have also included the ‘<guid>’ element as it is recommended by the Feed Validator. The ‘<guid>’ element uniquely identifies the item. In my case, the link URL is always unique and therefore works well as the ‘<guid>’. If the link to the article will always remain the same, then set ‘isPermaLink’ to ‘true’. If the URL will change, set it to ‘false’. You will need to edit the ‘<link>’ and ‘<guid>’ elements to display whatever web pages your site uses. The contents of the ‘<link>’ element contain the URL of the full document you are linking to. ‘<title>’ displays the title of the document (if your title field is not named ‘Title’ then rename ‘$row[Title]’ to suit your database).
  • 17. The ‘<description>’ element contains the text from the article that you want to have displayed in the RSS reader. An important part of this element’s contents is the CDATAsection. Normally, XML parses all of the text contained within it. So if your text contains characters like ‘<’ or ‘&’ then your description will be broken. If you plan on including images in your feed, then you’ll need to include the CDATA code.
  • 18. If the text you are including in your description can be very lengthy you may also want to consider using ‘substr’. So instead of displaying ‘<description><![CDATA[“.$row[Intro].”]]></description>’ you would show ‘<description> <![CDATA[“.substr($row[Intro],0,150).”]]></description>’. What the substr code does is start from the first character (represented by the ‘0’) and counts to the 150th character (represented by the ‘150’). Anything after the 150th character is not displayed. Again, feel free to change the ‘150’ to any number that suits your needs.
  • 19. Finally, another optional element I have included is the ‘<comments>’ element. IftheURL of your articl e allows for comments you can include a link to where the comments can be found. To get a full description of all the different tags available in RSS, check http://feedvalidator.org/docs/. All that is left to do now is close the ‘<channel>’ element and RSS document using PHP.
  • 20. echo“</channel></rss>”;?> You have now created an XML document/RSS feed. I have included the completed code on the following page. Please note, this tutorial does contain formatted text which you will need to replace if you plan on copying and pasting it into a program like Dreamweaver. Code such as “ and ” will have to be replaced (use Ctrl+Fin Dreamweaver to replace the text) so that it becomes unformatted.
  • 21. <?phpheader(“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>Feed title</title><description>A description of the feed contents</description><link>http://www.yoursite.com/</link>”;// Create a connection to your database.
  • 22. require(“db_connection.php“);// Query database and select the last 10 entries.$data = mysql_query(“SELECT * FROM table ORDER BY id DESC LIMIT 10”);while($row = mysql_fetch_array($data)){// Convert database images data into actual image link.$row[Intro] = str_replace(“images/”, “http://www.yoursite.com.au/images/”, $row[Intro]);// Continue with the 10 items to be included in the <item> section of the XML.
  • 24. // substr can limit the number of characters. First number is starting point while the second number is number ofcharacters.// otherwise just use $row[Intro].// <guid> is an optional sub-element of <item> but recommended if you don’t want to receive a warning whenvalidating your RSS.echo“</channel></rss>”;?>