I've got this bit of code employed in wordpress, to ensure that I've got a power grid of pictures for my wordpress posts. I'm looking to get this bit of code to operate, to ensure that whenever a category is loaded for instance

cat/id

the page loads up all the posts within that category id, inside the power grid layout too. but I am getting some difficulty. here's my original code:

    <div id="gridContainer">
<?php
$c = 1; //init counter
$bpr = 3; //boxes per row
if(have_posts()) :
    while(have_posts()) :
        the_post();
?>
            <div class="post" id="post-<?php the_ID(); ?>">
            <div class="postImage">
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('grid-post-image'); ?></a>
<h1 class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<h2 class="tags">
<?php echo strip_tags(get_the_tag_list('',', ','')); ?>
</h2>
<h3 class="date"><?php the_date('Y'); ?></h3>
            </div>
            </div>
<?php
if($c == $bpr) :
?>
<div class="clr"></div>
<?php
$c = 0;
endif;
?>
<?php
        $c++;
    endwhile;
endif;
?>
<div class="clr"></div>

now obvisously I have found code for example:

<?php query_posts('cat=x&showposts=10'); while(have_posts()) : ?>

however when I attempted including the code like:

query_posts('cat=x&showposts=10');
    while(have_posts()) :
        the_post();

it simply completely broke. server error. anybody have any idea how i'd integrate these together ?