Location: PHPKode > scripts > Query2RSS > query2rss/example.php
<?php
// Suppose there is a database connection section here.
// Suppose we have a "news" table with "title" and "content" fields.

// Step 1: Include Query2RSS class file in order to use it.
include_once "query2rss.class.php";

// Step 2: Initialiting our feed with the feed title, link and description.
$feed = new Query2RSS("Example Feed", "http://example.com", "An example RSS 2 feed");

// Step 3: Setting a custom feed property.
$feed->custom("language","en-us");

// Step 4: Fetching the last 5 news from the database.
$datas = mysql_query("SELECT * FROM news LIMIT 5");

// Step 5:  Mapping the query fields to the right feed elements.
$feed->fieldmap("title", "title");
$feed->fieldmap("content", "description");

// Step 6: Generating and printing the feed with our query.
echo $feed->generate($datas);
?>
Return current item: Query2RSS