Salve,
Ho creato una classifica che ogni 20 classificati, cambia di impaginazione,
Tutto funziona bene ma quando cambio pagina, la posizione ritorna ad 1 e non continua...
Per farvi capire meglio guardate questo link :
http://www.slevenservice.com/Templat...classifica.php
questo è lo script
Sapete aiutarmi? Grazie.Codice PHP:
<html>
<head>
<style>
body {
color: white;
}
table {
width: 400px;
background: red;
color: white;
font-size: 16px;
border: 2px solid black;
}
</style>
<link rel="shortcut icon" href="mt2.ico" type="image/x-icon" />
<?php
$pg = 21; // PG X OGNI PAGINA
$pagina = addslashes(trim($_GET['pagina']));
if (!$pagina){$pagina = 1;}
require ("conn.php") ;
mysql_select_db('player');
$query = mysql_query("SELECT level FROM player;");
$lv_tot = mysql_num_rows($query); // LIVELLI TOTALI
$pagine_totali = ceil($lv_tot / $pg);
$primo_pg = ($pagina - 1) * $pg;
$query2 = mysql_query("SELECT * FROM player WHERE level<'254' AND name NOT LIKE '[%' ORDER BY level DESC LIMIT $primo_pg, $pg;");
$num = mysql_num_rows($query2);
?>
<title>Classifica By WarXWar</title>
</head>
<body>
<center>
<table border="2">
<thead>
<tr>
<th width="10%" align="center">Numero</th>
<th width="10%" align="center">Nome PG</th>
<th width="10%" align="center">Livello</th>
<th width="10%" align="center">Exp</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
if ($num != 0) {
while ($i < $num) {
$array2 = mysql_fetch_array($query2);
$nome = $array2['name'];
$level = $array2['level'];
$exp = $array2['exp'];
?>
<tr>
<td align='center'><?php echo $i; ?></td>
<td align='center'><?php echo $nome; ?></td>
<td align='center'><?php echo $level; ?></td>
<td align='center'><?php echo $exp; ?></td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
<?php
}else{ echo "Attualmente La Classifica è Vuota!"; }
if ($pagine_totali > 1){
if ($pagina > 1){ ?>
[url="classifica.php?pagina=<?php echo $pagina-1; ?>"]Indietro[/url]
<?php
}
if ($pagine_totali > $pagina){
?>
[url="classifica.php?pagina=<?php echo $pagina+1; ?>"]Avanti[/url]
<?php
}
}
mysql_close();
?>
</center>
</body>
</html>