RSS not automatically updating

Hi everyone!

I created a blog website which has an RSS feed. This is my first time working with RSS and XML so I’m positive I’m missing something important.

The problem is that the RSS feed only updates if I’m in Google Reader and press refresh. Otherwise it doesn’t seem to catch the new blog that’s created.

The way I’m creating it is through PHP which is writing to an XML file with all the appropriate XML tags. Here’s the PHP:


// XML/RSS header tags
$xml = "<?xml version=\\"1.0\\"?>" .
		"<rss version=\\"0.91\\" >" .
			"<channel>" .
				"<language>en-us</language>" .
				"<link></link>" .
				"<title>The Blog</title>" .
				"<description>This is a blog about cool things.</description>";

// Write header to xml file
$f_handle = fopen("index.xml", "w");
fputs($f_handle, $xml);

//SQL Select statement then loop through record set
$strSql = mysql_query("SELECT * FROM tableName ORDER BY ID DESC LIMIT 10", $oConn);

while($row = mysql_fetch_array($strSql)){
	$title = $row['Title'];
	$date = $row['Date'];
	$ID = $row['ID'];
	$blog = $row['Blog'];
	$xml = 	"<item>" .
					"<title>" . $title . " - " . $date . "</title>" .
					"<link></link>" .
					"<description><![CDATA[ " . $blog . " ]]></description>" .
	fputs($f_handle, $xml);

//RSS closing tag
$xml = 		"</channel>".
// Close xml file
fputs($f_handle, $xml);


Is there something I’m missing? Perhaps a special tag that would notify the reader about the new blog?

Thinking out loud, do you suppose that it’s not updating properly because I’m ordering the sql recordset in descending order? I suppose if the RSS reader doesn’t look at the first blog in the list it wouldn’t catch it…