Hello,
I need help creating a pagination function in PHP. I have created one that works great if it exist in the index page. I tried to put it in an PHP class it didn't work. Any help please. This is the code:
function paging($eu,$limit,$back,$next,$nume,$t1)
{
$l=1;
$i=0;
echo $eu; //$
echo $limit; // maximum record per page
//echo $back;
echo $next; //next page
echo $nume; // number of rows
if($back >=0)
{
$a = "<a _href='index?start=$back'>PREV</a>";
}
else
{
$a ="";
}
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i <> $eu)
{
$b = " <='index?start=$i'>$l</a>";
$c = "";
}
else
{
$b = "";
$c =$l;
$l=$l+1;
}
}
if($t1 < $nume)
{
$e = "<='index.php?start=$next'>NEXT</a>";
}
$pg = "
<table>
<tr>
<td>$a</td>
<td>$b $c</td>
<td>$e</td>
</tr>
</table>
";
return $pg;
}