Qualcuno sa dirmi cosa non funziona in questa paginazione? Il codice sembra ok ma sul mio dominio non va, su un altro invece funziona, praticamente se clicco su successivi rimane a pagina 1... forse c'è qualcosa di obsoleto?
Codice PHP:
<?php
include("dbinfo.php");
$connect = mysql_connect($host, $dbuser, $dbpasswd) or
die('[b]MySQL Connection Error:[/b] ' .
mysql_errno() . ': ' .
mysql_error());
mysql_select_db($database, $connect) or
die('[b]Database Connection Error:[/b] ' .
mysql_errno() . ': ' .
mysql_error());
$usr_id = 63;
if (!isset($start) OR $start<0)
$start=0;
$step = 5;
?>
<table width="650" border="0">
<tr>
<td width="20%" align="left"><?
if ($start>0)
{ $start_back = $start - $step;
echo "<a href=mytracks.php?start=$start_back>precedenti</a>";
}
?></td>
<?
$query = "SELECT count(*)as tot FROM jos_sobi2_item WHERE owner=$usr_id";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$pages = intval(($row['tot']-1) / $step)+1;
//echo $pages;
//echo $row['tot'];
?>
<td width="60%" align="center"><?
for ($i=0; $i<$pages AND $i<5; $i++)
{ $start_page = $i * $step;
echo "<a href=mytracks.php?start=$start_page>" . ($i+1) . "</a> ";
}
?></td>
<td width="20%"><?
if ($start + $step < $row['tot'])
{ $start_next = $start + $step;
echo "<a href=mytracks.php?start=$start_next>successivi</a>";
}
?></td>
</tr>
</table>
<?php
$query = "SELECT title,owner FROM `jos_sobi2_item` WHERE owner=$usr_id ORDER BY title ASC LIMIT $start,$step";
$result = mysql_query($query);
$col = 0;
$max_col = 1;
while ($linea = mysql_fetch_array($result)) {
if($col >= $max_col) {
$col = 0;
echo "";
}
print " <td height='20' align='left'>[url=""][b]".$linea['title']." [/b][/url]</td>
</tr>
<tr><td colspan='9' height='1' align='right' valign='bottom' bgcolor='#EEEEEE'>[img]px.jpg[/img]</td></tr></table>";
++$col;
}
?>