Niggling RSS question

Space Goat

"It's a faaaake!"
Jan 1, 1970
432
0
0
35
Washington, D.C.
www.hypersyl.com
#1
For my new Hypersyllogistic web site, I've followed Gitch's suggestion on TrekWeb that I implement an RSS feed. But, for some reason, when I use Bloglines--which I guess is a fairly good RSS reader--only the first four entries in my article database show. Articles after that don't appear. Why might this be the case? I'm reproducing my code below, in case that might help:

Code:
<?php
header('Content-type: text/xml');
require '../includes/database.php';
?>
<rss version="2.0">
<channel>
<title>Hypersyllogistic: A Home for Politics without Histrionics</title>
<description>Hypersyllogistic features commentary and argument about politics and current events. Read screeds from the site's creator, Jason Vines, and then sound off on the forums!</description>
<link>http://www.hypersyllogistic.com</link>
<copyright>Jason Vines, 2000-2005.</copyright>

<?php
$query = "SELECT UNIX_TIMESTAMP(screed_time) AS time, DAYOFYEAR(screed_time) AS day, screed_title FROM screeds ORDER BY time DESC LIMIT 0, 10";
$result = mysql_query($query);
$array = mysql_fetch_array ($result);

while ($array = mysql_fetch_array ($result)) {
	$time = strftime("%a, %d %b %Y %T %Z",$array['time']);
	$day = $array['day'];
	$screed_title = strip_tags($array['screed_title']);
?>

	
	<item>
	<title><?php print htmlentities($screed_title, ENT_QUOTES); ?></title>
	<link>http://www.hypersyllogistic.com/pastscreed.php?id=<?php print $day; ?></link>
	<pubDate><?php print $time; ?></pubDate>
	</item>
	
<?php
}
?>

</channel>
</rss>
The weirdest thing is, the query I use in the file retrieves all of my articles in phpmyadmin.

I guess Bloglines could be what's screwing up; if that's the case, can anyone recommend a good RSS aggregator?

EDIT: Here's a link to my RSS feed in question: http://www.hypersyllogistic.com/rss/rss.xml

I've used an .htaccess file to make my server parse .xml files in the rss directory as .php files.
 

Arik

Administrator
Staff member
Jan 1, 2010
2,307
1
38
#3
A little bit of debugging...

Code:
 <?php
 header('Content-type: text/xml');
 require '../includes/database.php';
 ?>
 <rss version="2.0">
 <channel>
 <title>Hypersyllogistic: A Home for Politics without Histrionics</title>
 <description>Hypersyllogistic features commentary and argument about politics and current events. Read screeds from the site's creator, Jason Vines, and then sound off on the forums!</description>
 <link>http://www.hypersyllogistic.com</link>
 <copyright>Jason Vines, 2000-2005.</copyright>
 
 <?php
 $query = "SELECT UNIX_TIMESTAMP(screed_time) AS time, DAYOFYEAR(screed_time) AS day, screed_title FROM screeds ORDER BY time DESC LIMIT 0, 10";
 $result = mysql_query($query);
 $array = mysql_fetch_array ($result);
 $numResults = mysql_num_rows($result);
 $numInArray = count($array);
 $numIterations = 0;
 
 echo 'Number of rows returned: ' . $numResults;
 echo ' Numer of items in the array: ' . $numInArray;
 
 while ($array = mysql_fetch_array ($result)) {
         $numIterations++
 	$time = strftime("%a, %d %b %Y %T %Z",$array['time']);
 	$day = $array['day'];
 	$screed_title = strip_tags($array['screed_title']);
 ?>
 
 	
 	<item>
 	<title><?php print htmlentities($screed_title, ENT_QUOTES); ?></title>
 	<link>http://www.hypersyllogistic.com/pastscreed.php?id=<?php print $day; ?></link>
 	<pubDate><?php print $time; ?></pubDate>
 	</item>
 	
 <?php
 }
 echo 'The while loop went for ' .  $numIterations . ' iterations';
 ?>
 
 </channel>
 </rss>
How many items are being returned from the query and how many are being put into the array? How many iterations is the while loop really going for?
 

Space Goat

"It's a faaaake!"
Jan 1, 1970
432
0
0
35
Washington, D.C.
www.hypersyl.com
#4
Thanks so much for the help, Arik. :)

Here are the results I received. http://www.hypersyllogistic.com/rss/rsstest.xml

Number of rows returned: 5
Numer of items in the array: 6
The while loop went for 4 iterations
The number of rows is right; that's how many articles I have in my screeds table now. But why would the while loop only run four times and then quit? :confused:
 

Arik

Administrator
Staff member
Jan 1, 2010
2,307
1
38
#5
Agamemnon said:
Thanks so much for the help, Arik. :)

Here are the results I received. http://www.hypersyllogistic.com/rss/rsstest.xml


The number of rows is right; that's how many articles I have in my screeds table now. But why would the while loop only run four times and then quit? :confused:
Because you're burning the first item your query is returning...

Take out the first

Code:
 $array = mysql_fetch_array ($result);
That should work better. :)