levidyllan Posted May 2, 2008 Share Posted May 2, 2008 To explain what I am after heres what I want to do, a bit of background. I have a flash file that I am currently programming (AS2) which will have a section that will have dynamically loaded text. Now this text will be within a MySQl db. Now I used to have a a php file that I used for my RSS page and what this did would when called (myRss.php) would connect to the db then fetch the details I want then convert it to rss/xml and display as a RSS page. Due to stupid old me I seemed to have deleted my only copy of the php code and this would have been ideal to use for my flash inwhich to call then get the data Another way which I have not dabbeled is using php within flash direct, which could be another possibility. Any way if any body knows of any good eg's of such code this would be great many thanks me Link to comment https://forums.phpfreaks.com/topic/103911-php-into-xmlrss/ Share on other sites More sharing options...
Rohan Shenoy Posted May 2, 2008 Share Posted May 2, 2008 So want a PHP script that will output a RSS file? http://creativecoding.webforumz.com/editions/2007/december/tutorials/rss-feeds-with-php.php Link to comment https://forums.phpfreaks.com/topic/103911-php-into-xmlrss/#findComment-532000 Share on other sites More sharing options...
levidyllan Posted May 7, 2008 Author Share Posted May 7, 2008 I have found and used this: <?php header('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>???</title> <description>???</description> <link>???>/link>'; // Create a connection to your database. require_once ('connection file'); // Connect to the db. // Query database and select the last 10 entries. $data = mysql_query('SELECT * FROM ??? ORDER BY ??? DESC'); while($row = mysql_fetch_array($data)) { echo ' <item> <title>'.$row['headn'].'</title> <pubdate>'.$row['date'].'</pubdate> <description><![CDATA['.$row['news'].']]></description> <link>'.$row['link'].'</link> </item>'; } echo ' </channel> </rss>'; ?> cheers Link to comment https://forums.phpfreaks.com/topic/103911-php-into-xmlrss/#findComment-535457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.