Salve,
qualcuno potrebbe darmi una MANO ?
non capisco xché si comporta in questo modo il sistema di impaginazione di un database con circa 20.000 records.
In pratica, via query comando di visualizzare soltanto i record che rientrino in una data specifica e come nella foto tutti i record datati 02/08/2004. Il problema consiste nel fatto che lo script mi propone comunque tutti i link alle pagine che teoricamente contengono record secondo le specifiche della query.
I Record con tale data sono presenti soltanto nelle prime 5 pagine; come mai lo script mi propone circa 700 links ?

Codice PHP:
// get the pager input values
$page = $_GET['page'];
$limit = 30;
$result = mysql_query("select count(*) from $table");
$total = mysql_result($result, 0, 0);
// work out the pager values
$pager = Pager::getPagerData($total, $limit, $page);
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
// use pager values to fetch data
$query = "SELECT * "
. " FROM $table "
. " WHERE data = \"02/08/2004\" LIMIT $offset, $limit";
//$query = "select * from $table order by id limit $offset, $limit";
$result = mysql_query($query);
// output page content
while (list($id, $data, $ora, $terminale, $originalcode) = mysql_fetch_row ($result)) {
echo " <table border=\"0\" cellspacing=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"500\">\n".
" <tr>".
" <td width=\"100\">[b]ID[/b]</td>\n".
" <td width=\"381\">$id</td>\n".
" </tr>\n".
" <tr>\n".
" <td width=\"100\">[b]Data[/b]</td>\n".
" <td width=\"381\">$data</td>\n".
" </tr>\n".
" <tr>\n".
" <td width=\"100\">[b]Orario[/b]</td>\n".
" <td width=\"381\">$ora</td>\n".
" </tr>\n".
" <tr>\n".
" <td width=\"100\">[b]Terminale[/b]</td>\n".
" <td width=\"381\">$terminale</td>\n".
" </tr>\n".
" </table>\n".
"
\n\n";
}
// output paging system (could also do it before we output the page content)
if ($page == 1) // this is the first page - there is no previous page
echo "Previous";
else // not the first page, link to the previous page
echo "<a href=\"paging.php?page=" . ($page - 1) . "\">Previous</a>";
for ($i = 1; $i <= $pager->numPages; $i++) {
echo " | ";
if ($i == $pager->page)
echo "Page $i";
else
echo "<a href=\"paging.php?page=$i\">Page $i</a>";
}
if ($page == $pager->numPages) // this is the last page - there is no next page
echo "Next";
else // not the last page, link to the next page
echo "<a href=\"paging.php?page=" . ($page + 1) . "\">Next</a>";
?>