Wordpress Pagination not working

Why my wordpress pagination is not working, here is my code.



<?PHP header(); 

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'cat=3&paged='.$paged); 

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
    <?php endwhile; ?>
        
        <?php if(function_exists('wp_pagenavi')) { ?>     
        <div id="page-navigator">
        <?php wp_pagenavi(); ?>
        </div>     
        <?php } else { // Otherwise, use traditional Navigation ?>     
        <div class="navigation">     
            <div class="floatleft">
            <?php next_posts_link('&laquo; Next') ?>
            </div>     
            <div class="floatright">
            <?php previous_posts_link('Previous &raquo;') ?>
            </div>     
        </div>     
        <?php } ?>
    <?php endif; ?>

Output is fine, I can see the pages numbers but When I click on page not 2 or 3 it redirects me to the same page.

I removed WPagenavi code and just use wordpress pagination code but result is same, it redirects me to the same page with same results…

Where I am wrong please help me, It’s urgent…

Here’s a step by step guide to using pagination.