Can someone please alter the following code to include pagination, iv been doing this for 2 days but cant get it right.

<?php

    session_start();
    if (isset($_SESSION['username']) == false){
        header("Location:login.php");
        exit();
    }


    require "connect.php";
    $sortby = $_GET['var'];
    $query = "select * from form ORDER by $sortby";
    $result = mysql_query($query, $connection) or die ("MySQL Error: ".mysql_error());


?>

 <td width="128"><div align="center" class="style8"><a href="enquiryscreen.php?var=formID">Enquiry Number</div></td>
    <td width="125"><div align="center" class="style8"><a href="enquiryscreen.php?var=issuetitle">Issue Title </div></td>
    <td width="136"><div align="center" class="style8"><a href="enquiryscreen.php?var=datesubmitted">Date Submitted </div></td>
    <td width="118"><div align="center" class="style8"><a href="enquiryscreen.php?var=systemaffected">System Affected </div></td>
    <td width="131"><div align="center" class="style8"><a href="enquiryscreen.php?var=prioritylevel">Priority Level </div></td>
    <td width="49"><div align="center" class="style8"><a href="enquiryscreen.php?var=teamname">Team </div></td>
    <td width="89" class="style8"><div align="center"><a href="enquiryscreen.php?var=employeeID">Employee</div></td>
    <td width="16">&nbsp;</td>
    <td width="520"><span class="style4"></span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td width="16">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td width="64">&nbsp;</td>
    <td width="64">&nbsp;</td>
    <td width="20">&nbsp;</td>
    <td width="68"><?php
    while($row= mysql_fetch_array($result)){?></td>
    <td height="35"><div align="center" class="style7"><?php echo $row['formID'];?></div></td>
    <td height="35"><div align="center" class="style7"><?php echo $row['issuetitle'];?></div></td>
    <td height="35"><div align="center" class="style7"><?php echo $row['datesubmitted'];?></div></td>
    <td height="35"><div align="center" class="style7"><?php echo $row['systemaffected'];?></div></td>
    <td height="35"><div align="center"><span class="style7"><?php echo $row['prioritylevel'];?></span></div></td>
    <td height="35"><div align="center"><span class="style7"><?php echo $row['teamname'];?></span></div></td>
    <td height="35"><div align="center" class="style7"><?php echo $row['employeeID'];?></div></td>
    <td width="16">&nbsp;</td>
    <td><a href="analystformedit.php?formID=<?php echo $row['formID'];?>">
      <div align="left"><img src="Images/smallopenbutton.jpg" width="66" height="22"></div></td>

Basically i want 10 results shown per page, i will make a large donation to the site if i can get this working, Thanks

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.