1

This is the current code for my RSS Feed:

<?php header("Content-type: text/xml"); ?>
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>
<?php include('directory/database.php'); ?>
<rss version="2.0">
<channel>
  <title>Website Reviews</title>
  <link>http://www.mywebsite.com</link>
  <description>My Website's Description</description>
  <pubDate><?echo date('Y/m/d H:i:s');?></pubDate>

<?php
    foreach( range( 1, 30 ) as $i ):
        $domain = mt_rand( 1, 62246 );
?>
<item>
    <title><?php echo $domain; ?> REVIEW</title>
    <pubDate><?echo date('Y/m/d H:i:s');?></pubDate>
    <link>http://www.mywebsite.com/review/<?php echo $domain; ?></link>
    <description>Looking for a review on <?php echo $domain; ?>?  We've got it!</description>
</item>
<?php endforeach; ?>

</channel>
</rss>

This is the specific code that I need help changing:

<?php
    foreach( range( 1, 30 ) as $i ):
        $domain = mt_rand( 1, 62246 );
?>

Basically instead of generating a random number, I need it to pull one of the domain names from my database. I have a large list of domains in my database in the table "list" under the column "website".

I have 30 different RSS items displaying and each needs to have a different domain name associated with the item. Thanks in advance!

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
user1848777
  • 551
  • 1
  • 4
  • 9
  • So [your problem](http://stackoverflow.com/questions/13547569/random-number-in-rss-feed) is change now. – Shiplu Mokaddim Nov 25 '12 at 02:23
  • Nope, I'm working with two different RSS feeds. The question you're referring to fixed one of my feeds, this is the other one I'm working on now. – user1848777 Nov 25 '12 at 02:24

0 Answers0