while statement isn't working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

while statement isn't working

Post by someguyhere »

Does anyone see any reason this while statement returns all results instead of limiting them?

Code: Select all

$i = 0;
while ($i < 2) {
	foreach ($rss->items as $item ) {
		$title = $item[title];
		$url = $item[link];
		$desc = $item[description];
		$rss_feed .= "<li><a href=$url>$title</a><br />$desc</li>";
		$i++;
	}
}
Post Reply