Esato Mobile
General discussions : Non mobile discussion : MySQL and RSS help
> New Topic
> Reply
< Esato Forum Index > General discussions > Non mobile discussion > MySQL and RSS help Bookmark topic
Page <  12

Jim Posts: > 500

Well I chaned everything, here is the code if someone is interested:

Code:<?php
header("Content-Type: text/xml; charset=iso-8859-1");

if (!$link = mysql_connect("localhost", "username", "password"))
exit("Unable to make a connection to the database");
if (!mysql_select_db("my_database", $link))
exit("Unable to select the database");
// Define a SQL Select Query
$query = "select nomsite, url, description, date from annuaire_sites where valid='1' order by date and id limit 10";
if (!$result = mysql_query($query, $link))
exit("Illegal query");
// Start the xml output
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<rss version=\"2.0\">
<channel>
<title>My title</title>
<link>My URL</link>
<description>My description</description>
<language>en-us</language>
<generator>My generator</generator>";
// Display the results of the query
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$title = $row["nomsite"];
$link = $row["url"];
$description = $row["description"];

echo "<item>";
echo "<title>$title</title>";
echo "<link>$link</link>";
echo "<description>$description</description>";
echo "</item>\n";
}
echo "</channel></rss>";
?>
--
Posted: 2005-04-07 10:10:10
Edit : Quote
Page <  12

New Topic   Reply
Forum Index

Esato home