I have a problem of pagination of turns out you of one query of search on a DB MySQL. With this code I succeed to visualize the first 5 records out to you in one page but when go in the successive pages it makes to see the first 5 records me of mine database. This is the code:

$c or die ("Errore nella connessione al Mysql:" . mysql_error());
mysql_select_db($db_database,$connessione) or die ("Errore nella selezione del db:" . mysql_error());
$numero_record = 5;
    $inizio = 0;
    $inizio = $HTTP_GET_VARS["inizio"];
$query_limit="SELECT AnnoRipresa, Id, FROM table_name WHERE AnnoRipresa LIKE '%$_POST[AnnoRipresa]%'
order by Id limit $inizio, $numero_record" or die ("Errore :" . mysql_error());;
$query = mysql_query($query_limit);
$select = "SELECT AnnoRipresa, Id,  FROM table_name WHERE AnnoRipresa LIKE '%$_POST[AnnoRipresa]%'";
$query2 = mysql_query($select);
$numero_record_totali = mysql_numrows($query2); 
$numero_pagine = ceil($numero_record_totali/$numero_record); 
$pagina_corrente = ceil(($inizio/$numero_record) + 1);
<td colspan="2">
echo <tr>
<td height="22" width="20%"><h4><b>Anno Ripresa</b></td>
echo "<td>" . $riga['Id'] . "</td>";
echo "</tr>";
if($numero_pagine > 1){
     for($pagina = 1; $pagina <= $numero_pagine; $pagina++){
          if($pagina == $pagina_corrente){ ?>
         <?php  }else{
<a href="fotografie_aeree_verticali.php?inizio=<?=(($pagina - 1) * $numero_record)?>"><?=$pagina?></a>

have you tried the PEAR:Pager package? It is really easy to use and is debugged for you. There are also plenty of other packages around, try phpclasses.org as well.