I have to display numbers of data which are in flat file in 50 pages. I am trying to write one php code for displaying 50 pages, rather than writing 50 separate codes.
Can anyone help me with algo?
filename<<index.php>>
global $k;
$handle=@fopen($result, "r");
$data=file_get_contents($result);
$data= explode(",",$data); //changing string into array
$data=array_unique($data);
$c=count($data);
$k=1;
while($k<$c)
{
$start = $k;
$end = $k + 1000;
$k += 1000;
for($j=$start; $j<=$end; $j++)
{
echo $data[$j];
}
echo "<a href=\"index.php\">Next</a> ";
break;
}
It displays the first 1000 data in a page. But after clicking "Next" it again displays the same result.