I try to limit query results and fetched items in same time.
But, with my script, that is not functioning together. Selected item is not staying as variable in query. Something is badly ordered in this script.

    if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
    $startrow = 0;
    else {
    $startrow = (int)$_GET['startrow'];
    echo '<table class="tabs">
    <td><a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'"><input type="button" name="next" value="Next" class="nextbutton" /></a></td>
    <form name="deal" method="post" action="">
    <td><select required name="deal" onchange="javascript: submit()" class="tblselect">
    <option value="">Period</option>';
    $query = mysqli_query($db,"SELECT DISTINCT icycle FROM offer WHERE orderstatus='Billable' ORDER BY icycle ASC");
    $result = ($query) or die ('Error in query: $query. ' . mysqli_error());
    while($row = mysqli_fetch_array($result))
    echo'<option value ='.$row['icycle'].'>'.$row['icycle'].'</option>';
    $prev = $startrow - 10;
    if ($prev >= 0)
    echo '<td><a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'"><input type="button" name="prev" value="Previous" class="prevbutton" /></a></td></form></table>';
    $fetch = mysqli_query($db,"SELECT * FROM offer WHERE icycle='Now' AND orderstatus='Billable' GROUP BY offerid ORDER BY custname LIMIT $startrow, 10")or die(mysql_error());

    $deal = $_POST['deal'];
    $fetch = mysqli_query($db,"SELECT * FROM offer WHERE icycle='$deal' AND orderstatus='Billable' GROUP BY offerid ORDER BY custname LIMIT $startrow, 10")or die(mysql_error());

Have you checked the content of $row array
Near line no 15:
Debug like this way, by adding the following code

$row = mysqli_fetch_array($result)

Yes, there is content in selection-list. That var_dump get those dissapering.
After selection, startrow is not functioning. It doesn't keep the selected value, and show next rows.

After hard testig and basket of beer, i figure this out. Tested and working, with adding filter-value within startrow-variable in href-link:
<a href="'.$_SERVER['PHP_SELF'].'?icycle='.$icycle.'&startrow='.($startrow+10).'">

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.