Wordpress category loop

Hi I am having a very wired problem in wordpress category loop.

here is the code :

<?php 
		$categories = get_categories('hide_empty=1'); 
		foreach ($categories as $category) :
		query_posts('showposts=1&cat='.$category->cat_ID);
		if (have_posts()) : the_post();
		?>
		
		<!-- begin post -->
		<div class="post">
		<h2><a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name ?></a></h2>
		<div class="thumb"><a href="<?php the_permalink(); ?>"><?php getImage('1'); ?></a></div>
		<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
		<p><?php echo dp_clean($post->post_content, 300); ?></p>
		<a href="<?php the_permalink(); ?>" class="readmore">Read More</a>
		</div>
		<!-- end post -->
		
		<?php endif; endforeach; ?>

even if i put showposts=2 to show two postys of a single category dont know why it is still showing only one post?

please need help…

Because your post output is not in a loop and only outputs the first post. Try this:


<?php  
	$categories = get_categories('hide_empty=1');  
	foreach ($categories as $category) : 
		query_posts('showposts=2&cat='.$category->cat_ID); 
		while(have_posts()){
			the_post(); 
			?>
			<!-- begin post --> 
			<div class="post"> 
			<h2><a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name ?></a></h2> 
			<div class="thumb"><a href="<?php the_permalink(); ?>"><?php getImage('1'); ?></a></div> 
			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> 
			<p><?php echo dp_clean($post->post_content, 300); ?></p> 
			<a href="<?php the_permalink(); ?>" class="readmore">Read More</a> 
			</div> 
			<!-- end post --> 
	<?php	 }
	endforeach; ?>