I found this code and was trying to make it work... I think it's probably the "shortest" way to do this, and I was able to understand it quite well.. Only problem is that it uses functions which I am not familiar with...
Can anyone help me debug it ?
<?
include "connect.php";
if(!isset($start)){
$start = "0";
$showmax = "20"; // max records per page to display
// count all records
$results = mysql_query("select * from qg_clients");
$totalrecords = msql_num_rows($results);
// select only records you want to view
$result = mysql_query("SELECT * FROM qg_clients LIMIT '$start' , '$showmax'");
while($krop=mysql_fetch_array($result)){
$nom=$krop['nom'];
echo "$nom";
}
// in our example, $pagesleft will be set to the integer value of 10.1, or simply 10. $remainder will be set to .1. If the $remainder is anything but 0 then you need to add another page.
$pagesleft = ceil($totalrecords / $showmax);
echo "<br><br>Page : ";
for($nextpage=1;$nextpage <=$pagesleft;$nextpage++){
$nextstartitem = (($nextpage-1)*$showmax);
echo "<a href=$PHP_SELF?start=$nextstartitem>$nextpage</a> ";
}
?>