I have a DB with 14 records. What I would like to do is print 6 records at a time and then a back/forward button to move to the next 6 and then to the next 2, etc... I am able to break it down into the 6,6 and 2. Yet I have no idea on how to put in a button to allow me to move back and forth. I am currently using a function for my printing. Is this even possible without using some sort of javascript or VB script? I would rather like to keep it all within the same subroutine without using VBS or JS. Here is what I have so far:
<?
$query = mysqli_query ($dbconnect,"select * from datatable")
or die ("the table Query FAILED!");
$numofrows = mysqli_num_rows($query);
if ($numofrows == 0)
die ("no data in table");
$printedrows=0;
$rownum=$numofrows;
/ Print Database /
do
{
print_table($rownum,$query);
$maxrows=$_POST['maxrows'];
$printedrows=$printedrows+$maxrows;
$rownuw=$rownum-$maxrows;
}
while ($printedrows<$numofrows);
<?
function print_table($rows,$query)
{
echo "<table border>";
for ($rowcounter=1;$rowcounter <= $maxrows;$rowcounter++)
{
$getrow = mysqli_fetch_array($query);
$rowid=$getrow['id'];
echo "<tr>";
echo"<td class='norm' align='left' valign='top'>";
?>
<a href="view_record.php?id=<?=$rowid?>"</a>
<?=$rowid?>
<?
echo"</td>";
echo"<td class='norm' align='left' valign='top'>";
echo $getrow['fname'];
echo"</td>";
echo"<td class='norm' align='left' valign='top'>";
echo $getrow['lname'];
echo"</td>";
echo"<td class='norm' align='left' valign='top'>";
echo $getrow['city'];
echo"</td>";
echo"</tr>";
}
echo"</table>";
$_POST['maxrows']=$maxrows;
return;
}
?>
Any help would be appreciated!
Thanks,
Brent