473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on pagination please

64 New Member
I have a pagination function I am using in a file called functions.php as below
Expand|Select|Wrap|Line Numbers
  1. <? //Pagination functions  function getPagingQuery($sql, $itemPerPage = 10) {    if (isset($_GET['page']) && (int)$_GET['page'] > 0)    {       $page = (int)$_GET['page'];    }    else    {       $page = 1;    }        // start fetching from this row number    $offset = ($page - 1) * $itemPerPage;        return $sql . " LIMIT $offset, $itemPerPage"; }  /*    Get the links to navigate between one result page to another.     */ function getPagingLink($sql, $itemPerPage = 10, $strGet = '') {    $result        = dbQuery($sql);    $pagingLink    = '';    $totalResults  = dbNumRows($result);    $totalPages    = ceil($totalResults / $itemPerPage);        // how many link pages to show    $numLinks      = 10;            // create the paging links only if theres more than one page of results    if ($totalPages > 1) {           $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ;               if (isset($_GET['page']) && (int)$_GET['page'] > 0) {          $pageNumber = (int)$_GET['page'];       } else {          $pageNumber = 1;       }              // print 'previous' link only if its not       // on page one       if ($pageNumber > 1) {          $page = $pageNumber - 1;          if ($page > 1) {             $prev = " <a href=\"$self?page=$page&$strGet/\">[Prev]</a> ";          } else {             $prev = " <a href=\"$self?$strGet\">[Prev]</a> ";          }                          $first = " <a href=\"$self?$strGet\">[First]</a> ";       } else {          $prev  = ''; // on page one, don't show 'previous' link          $first = ''; // nor 'first page' link       }           // print 'next' link only if its not       // on the last page       if ($pageNumber < $totalPages) {          $page = $pageNumber + 1;          $next = " <a href=\"$self?page=$page&$strGet\">[Next]</a> ";          $last = " <a href=\"$self?page=$totalPages&$strGet\">[Last]</a> ";       } else {          $next = ''; // if on the last page, don't show 'next' link          $last = ''; // nor 'last page' link       }        $start = $pageNumber - ($pageNumber % $numLinks) + 1;       $end   = $start + $numLinks - 1;                    $end   = min($totalPages, $end);              $pagingLink = array();       for($page = $start; $page <= $end; $page++)   {          if ($page == $pageNumber) {             $pagingLink[] = " $page ";   // no need to create a link to current page          } else {             if ($page == 1) {                $pagingLink[] = " <a href=\"$self?$strGet\">$page</a> ";             } else {                   $pagingLink[] = " <a href=\"$self?page=$page&$strGet\">$page</a> ";             }             }           }              $pagingLink = implode(' | ', $pagingLink);              // return the page navigation link       $pagingLink = $first . $prev . $pagingLink . $next . $last;    }        return $pagingLink; } ?>
I include that functions.php in every page because it contains all the functions I need

However, when I add the pagination to my DB functions containing SQLs, it doesn't work. Code below:

Expand|Select|Wrap|Line Numbers
  1. <? function allsales_Today() {    $rowsPerPage = 5;     //$sql = 'SELECT * FROM cstocksales WHERE SaleDate = current_date';    $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate';        //$result = dbQuery($sql);    $result     = dbQuery(getPagingQuery($sql, $rowsPerPage));    $pagingLink = getPagingLink($sql, $rowsPerPage);        if (dbNumRows($result) == 0) //if none       {         echo '<p><font color=#CC0000><h4>No sales for today were found in the records...</h4></font></p>';       echo 'Go back <a href="index.php">Here</a> for another search.';    }    else    {       echo "<h5>Today's sales sales:<p></h5>";       echo '<table width="100%"  border="1" bordercolor="#000000">';      echo'<tr>';       echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';       echo'<th scope="col" bgcolor="#66FFFF">Category</th>';       echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';       echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';       echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';       echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';       echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';     echo'</tr>';      while($row = dbFetchArray($result))     // while($row = mysql_fetch_array($result))      {                 echo'<tr>';          echo'<td align="center">';          $SaleID = $row["SaleID"];                   echo $SaleID. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Category = $row["Category"];                   echo $Category. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Brand = $row["Brand"];                   echo $Brand. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Quantity = $row["Quantity"];                   echo $Quantity. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $PaidBy = $row["PaidBy"];                   echo $PaidBy. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Cost = $row["Cost"];                   echo $Cost. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $SaleDate = $row["SaleDate"];                   echo $SaleDate. "<br>";                   echo'</td align="center">';                   echo '</tr>';              }    echo'</table>';        //paginating link    echo $pagingLink;        echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>";        $sql_total = 'SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate GROUP BY PaidBy';        $result = dbQuery($sql_total);             while($row = dbFetchArray($result))         {        echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> =  Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>";       echo "&nbsp;&nbsp;"; echo"|"; echo "&nbsp;&nbsp;";       }           $sql_total_final = 'SELECT SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate';        $result = dbQuery($sql_total_final);    while($row = dbFetchArray($result))         {       echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ;       }    }     echo "<br>";    echo '<h4><a href="index.php">Back</a> to sales panel.'; } ?>
The first page is displayed well. When I click next, the page is blank and the URL is
http://localhost/cstock/admin/viewsa...es.php?page=2&

The URL for the search should be

http://localhost/cstock/admin/viewsa...=allsalestoday

Followed by the pagination as a user clicks next or a value in the pagination link

viewsales.php is the file containing sales functions

It only works if I put each function in its own page. My sales functions are many (33 functions) and so they are all in one file called view sales.php in a case statement.

How do I make it work if I have a file that contains all my sales functions and I want to use the pagination in each function?

my pagination function is in a file I call at the top of every page (functions.php)
Expand|Select|Wrap|Line Numbers
  1. <? //Pagination functions  function getPagingQuery($sql, $itemPerPage = 10) {    if (isset($_GET['page']) && (int)$_GET['page'] > 0)    {       $page = (int)$_GET['page'];    }    else    {       $page = 1;    }        // start fetching from this row number    $offset = ($page - 1) * $itemPerPage;        return $sql . " LIMIT $offset, $itemPerPage"; }  /*    Get the links to navigate between one result page to another.     */   function getPagingLink($sql, $itemPerPage = 10, $strGet = '') {    $result        = dbQuery($sql);    $pagingLink    = '';    $totalResults  = dbNumRows($result);    $totalPages    = ceil($totalResults / $itemPerPage);        // how many link pages to show    $numLinks      = 10;            // create the paging links only if theres more than one page of results    if ($totalPages > 1) {           $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ;               if (isset($_GET['page']) && (int)$_GET['page'] > 0) {          $pageNumber = (int)$_GET['page'];       } else {          $pageNumber = 1;       }              // print 'previous' link only if its not       // on page one       if ($pageNumber > 1) {          $page = $pageNumber - 1;          if ($page > 1) {             $prev = " <a href=\"$self?page=$page&$strGet/\">[Prev]</a> ";             ||             $prev = " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> ";          } else {             $prev = " <a href=\"$self?$strGet\">[Prev]</a> ";          }                          $first = " <a href=\"$self?$strGet\">[First]</a> ";       } else {          $prev  = ''; // on page one, don't show 'previous' link          $first = ''; // nor 'first page' link       }           // print 'next' link only if its not       // on the last page       if ($pageNumber < $totalPages) {          $page = $pageNumber + 1;          $next = " <a href=\"$self?page=$page&$strGet\">[Next]</a> "; || " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> ";          $last = " <a href=\"$self?page=$totalPages&$strGet\">[Last]</a> "; || " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> ";       } else {          $next = ''; // if on the last page, don't show 'next' link          $last = ''; // nor 'last page' link       }        $start = $pageNumber - ($pageNumber % $numLinks) + 1;       $end   = $start + $numLinks - 1;                    $end   = min($totalPages, $end);              $pagingLink = array();       for($page = $start; $page <= $end; $page++)   {          if ($page == $pageNumber) {             $pagingLink[] = " $page ";   // no need to create a link to current page          } else {             if ($page == 1) {                $pagingLink[] = " <a href=\"$self?$strGet\">$page</a> ";             } else {                   $pagingLink[] = " <a href=\"$self?page=$page&$strGet\">$page</a> ";             }             }           }              $pagingLink = implode(' | ', $pagingLink);              // return the page navigation link       $pagingLink = $first . $prev . $pagingLink . $next . $last;    }        return $pagingLink; } ?>
Like in this page (list.php)

Expand|Select|Wrap|Line Numbers
  1. <?php if (!defined('WEB_ROOT')) {    exit; } $rowsPerPage = 5;  $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI']; checkUser();  $sql = "SELECT * FROM fragrancestock"; $result     = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage);  $errorMessage = (isset($_GET['cstock_error']) && $_GET['cstock_error'] != '') ? $_GET['cstock_error'] : '&nbsp;'; ?> <form action="index.php?view=add" method="post"  name="frmList" id="frmList">   <table width="100%" border="0" align="center">     <tr class="title_text">       <td width="100">Category</td>       <td width="400">Brand</td>       <td width="100" align="center">Stock</td>       <td width="100">Date Added</td>       <td width="50">Details</td>       <td width="50">Add</td>       <td width="50">Delete</td>     </tr>     <?php if (dbNumRows($result) > 0) {    $i = 0;        while($row = dbFetchAssoc($result)) {       extract($row);                 if ($i%2) {          $class = 'row1';       } else {          $class = 'row2';       }              $i += 1; ?>     <tr class="<?php echo $class; ?>">       <td width="100"><?php echo $Category; ?></td>       <td width="400"><?php echo $Brand; ?></td>       <td width="100" class="inner_border"><?php echo $Quantity; ?></td>       <td width="100"><?php echo $DateAddedStock; ?></td>       <td width="50"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?view=detail&StockID=<?php echo $StockID; ?>">View</a></td>       <td width="50"><a href="javascript:modifyStock(<?php echo $StockID; ?>);"><strong>Add         </strong> </a></td>       <td width="50"><a href="javascript:deleteStock(<?php echo $StockID; ?>);">Delete</a></td>     </tr>     <?php    } // end while   ?>     <tr>       <td colspan="7" align="center">         <?php     echo $pagingLink;    ?>       </td>     </tr>     <?php    } else { ?>     <tr>       <td colspan="7" align="center">No Stock Items Yet</td>     </tr>     <?php } ?>     <tr>       <td colspan="7">&nbsp;</td>     </tr>     <tr>       <td colspan="7" align="right"> <input name="btnAddStock" type="submit" value="New Entry" class="button_image">     </tr>   </table> </form>  <label class="title_text">View Stock:</label> <hr> <table width="100%" border="0">   <tr>     <td><form action="index.php?view=showbybrand" method="post" name="frmByBrand">         <table width="100%" border="0">           <tr>             <td width="200">By Brand:</td>             <td width="200"><select name="sltBrand">                 <option value="0">Select Brand</option>                 <?          $sql = "SELECT DISTINCT Brand FROM cstockitems ORDER BY Brand ASC";          $result = dbQuery($sql);                          if(dbNumRows($result))          {             while($row = dbFetchAssoc($result))             {             echo "<option>$row[Brand]</option>";             }          }                 else                {             echo "<option>No Brands Present</option>";                }      ?>               </select></td>             <td width="200"><input type="submit" name="Submit" value="Show" class="button_image" onClick="return CheckShowBrandByBrand();">             </td>           </tr>         </table>       </form></td>   </tr>   <tr>     <td><form name="frmByCategory" method="post" action="showbycategory.php">         <table width="100%" border="0">           <tr>             <td width="200">By Category:</td>             <td width="200"><select name="sltCategory">                 <option value="0">Select Category</option>                 <?          $sql = "SELECT DISTINCT Category FROM cstockitems ORDER BY Category ASC";          $result = dbQuery($sql);                          if(dbNumRows($result))          {             while($row = dbFetchAssoc($result))             {             echo "<option>$row[Category]</option>";             }          }                 else                {             echo "<option>No Categories Present</option>";                }      ?>               </select></td>             <td width="200"><input type="submit" name="Submit2" value="Show" class="button_image" onClick="return CheckShowBrandByCategory();"></td>           </tr>         </table>       </form></td>   </tr>   <tr>     <td><form name="frmSearchBrand" method="post" action="showbysearch.php">         <table width="100%" border="0">           <tr>             <td width="200">Search:</td>             <td width="200"><input type="text" name="txtSearchBrand" size="40"></td>             <td width="200"><input type="submit" name="Submit3" value="Search" class="button_image" onClick="return CheckShowBrandBySearch();"></td>           </tr>         </table>       </form></td>   </tr> </table> <label class="title_text">Print product list for re-stocking:</label> <hr> <table width="100%" border="0" cellspacing="0" cellpadding="0">   <tr>     <td><a href="exportoutofstockfile.php">Out of stock:</a></td>     <td><a href="exportlowstockfile.php">Low stock:</a></td>     <td><a href="exportwarningstockfile.php">Stock running low:</a></td>    <td><a href="printstocksheet.php">Print stock sheet</a></td>   </tr> </table>   <script> function CheckShowBrandByBrand() {    form = window.document.frmByBrand;        if (form.sltBrand.selectedIndex == 0)    {       alert('You have not selected a brand to view details!');       return false;       }    else    {    return true;    } }  function CheckShowBrandByCategory() {    form = window.document.frmByCategory;        if (form.sltCategory.selectedIndex == 0)    {       alert('You have not selected a Category to view details!');       return false;       }    else    {    return true;    } }  function CheckShowBrandBySearch() {    form = window.document.frmSearchBrand;        if (form.txtSearchBrand.value == "")    {       alert('You have not entered a brand name to search!');       return false;       }    else    {    return true;    } } </script>
But you can see that page has one function so the pagination works well using the variable ($page)

My problem is how to make it work in a page containing multiple functions AND it works in every function
Where should I change without having to make a pagination function for every POST function

My page of functions where I want to use it below:

Expand|Select|Wrap|Line Numbers
  1. <? require_once '../../functions.php';    $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI']; checkUser();  $action = isset($_GET['action']) ? $_GET['action'] : ''; //$page = $_GET['action'];  switch ($action) {    case 'jan' :       sales_January();    break;           case 'feb' :       sales_February();    break;        case 'mar' :       sales_March();    break;           case 'april' :       sales_April();    break;        case 'may' :       sales_May();    break;           case 'june' :       sales_June();    break;        case 'july' :       sales_July();    break;           case 'aug' :       sales_August();    break;        case 'sept' :       sales_September();    break;           case 'oct' :       sales_October();    break;        case 'nov' :       sales_November();    break;           case 'dec' :       sales_December();    break;           case 'allsalestoday' :       allsales_Today();    break;           case 'allsalessevendays' :       allsales_SevenDays();    break;        case 'salesbycategory' :       salesbyCategory();    break;        case 'salesbybrand' :       salesbyBrand();    break;     default : }  function allsales_Today($action) {    $rowsPerPage = 2;     //$sql = 'SELECT * FROM cstocksales WHERE SaleDate = current_date';    $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate';        //$result = dbQuery($sql);    $result     = dbQuery(getPagingQuery($sql, $rowsPerPage));    $pagingLink = getPagingLink($sql, $rowsPerPage);        if (dbNumRows($result) == 0) //if none       {         echo '<p><font color=#CC0000><h4>No sales for today were found in the records...</h4></font></p>';       echo 'Go back <a href="index.php">Here</a> for another search.';    }    else    {       echo "<h5>Today's sales sales:<p></h5>";       echo '<table width="100%"  border="1" bordercolor="#000000">';      echo'<tr>';       echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';       echo'<th scope="col" bgcolor="#66FFFF">Category</th>';       echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';       echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';       echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';       echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';       echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';     echo'</tr>';      while($row = dbFetchArray($result))     // while($row = mysql_fetch_array($result))      {                 echo'<tr>';          echo'<td align="center">';          $SaleID = $row["SaleID"];                   echo $SaleID. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Category = $row["Category"];                   echo $Category. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Brand = $row["Brand"];                   echo $Brand. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Quantity = $row["Quantity"];                   echo $Quantity. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $PaidBy = $row["PaidBy"];                   echo $PaidBy. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Cost = $row["Cost"];                   echo $Cost. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $SaleDate = $row["SaleDate"];                   echo $SaleDate. "<br>";                   echo'</td align="center">';                   echo '</tr>';              }    echo'</table>';        //paginating link    echo $pagingLink;        echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>";        $sql_total = 'SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate GROUP BY PaidBy';        $result = dbQuery($sql_total);             while($row = dbFetchArray($result))         {        echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> =  Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>";       echo "&nbsp;&nbsp;"; echo"|"; echo "&nbsp;&nbsp;";       }           $sql_total_final = 'SELECT SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate';        $result = dbQuery($sql_total_final);    while($row = dbFetchArray($result))         {       echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ;       }    }     echo "<br>";    echo '<h4><a href="index.php">Back</a> to sales panel.'; }  function allsales_SevenDays() {    $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 8 DAY) <= SaleDate';       $result = dbQuery($sql);    ///$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));    //$pagingLink = getPagingLink($sql, $rowsPerPage);        if (dbNumRows($result) == 0) //if none       {         echo '<p><font color=#CC0000><h4>No sales for the past seven days were found in the records...</h4></font></p>';       echo 'Go back <a href="index.php">Here</a> for another search.';    }    else    {       echo '<h5>Sales in the past seven days:<p></h5>';       echo '<table width="100%"  border="1" bordercolor="#000000">';      echo'<tr>';       echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';       echo'<th scope="col" bgcolor="#66FFFF">Category</th>';       echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';       echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';       echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';       echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';       echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';     echo'</tr>';      while($row = dbFetchArray($result))      {        echo'<tr>';          echo'<td align="center">';          $SaleID = $row["SaleID"];                   echo $SaleID. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Category = $row["Category"];                   echo $Category. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Brand = $row["Brand"];                   echo $Brand. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Quantity = $row["Quantity"];                   echo $Quantity. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $PaidBy = $row["PaidBy"];                   echo $PaidBy. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Cost = $row["Cost"];                   echo $Cost. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $SaleDate = $row["SaleDate"];                   echo $SaleDate. "<br>";                   echo'</td align="center">';                   echo '</tr>';      }    echo'</table>';    //    echo 'Go back <a href="index.php">Here</a> for another search.';    } }   ///////////////////////////// function salesbyCategory() {    $byCategory = $_POST['sltCategory'];        $sql = 'SELECT * FROM cstocksales WHERE Category = "'.$byCategory.'"';        $result = dbQuery($sql);    ///$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));    //$pagingLink = getPagingLink($sql, $rowsPerPage);        if (dbNumRows($result) == 0) //if none       {         echo '<p><font color=#CC0000><h4>No sales for the Category "'.$_POST['sltCategory'].'" were found in the records...</h4></font></p>';       echo 'Go back <a href="index.php">Here</a> for another search.';    }    else    {       echo '<h5>"'.$_POST['sltCategory'].'" sales:<p></h5>';       echo '<table width="100%"  border="1" bordercolor="#000000">';      echo'<tr>';       echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';       echo'<th scope="col" bgcolor="#66FFFF">Category</th>';       echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';       echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';       echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';       echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';       echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';     echo'</tr>';      while($row = dbFetchArray($result))      {        echo'<tr>';          echo'<td align="center">';          $SaleID = $row["SaleID"];                   echo $SaleID. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Category = $row["Category"];                   echo $Category. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Brand = $row["Brand"];                   echo $Brand. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Quantity = $row["Quantity"];                   echo $Quantity. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $PaidBy = $row["PaidBy"];                   echo $PaidBy. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Cost = $row["Cost"];                   echo $Cost. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $SaleDate = $row["SaleDate"];                   echo $SaleDate. "<br>";                   echo'</td align="center">';                   echo '</tr>';      }    echo'</table>';    echo 'Go back <a href="index.php">Here</a> for another search.';    } }  function salesbyBrand() {    $byBrand = $_POST['sltBrand'];        $sql = 'SELECT * FROM cstocksales WHERE Brand = "'.$byBrand.'"';        $result = dbQuery($sql);    ///$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));    //$pagingLink = getPagingLink($sql, $rowsPerPage);        if (dbNumRows($result) == 0) //if none       {         echo '<p><font color=#CC0000><h4>No sales for the brand  "'.$_POST['sltBrand'].'" were found in the records...</h4></font></p>';       echo 'Go back <a href="index.php">Here</a> for another search.';    }    else    {       echo '<h5>"'.$_POST['sltBrand'].'" slaes:<p></h5>';       echo '<table width="100%"  border="1" bordercolor="#000000">';      echo'<tr>';       echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';       echo'<th scope="col" bgcolor="#66FFFF">Category</th>';       echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';       echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';       echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';       echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';       echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';     echo'</tr>';      while($row = dbFetchArray($result))      {        echo'<tr>';          echo'<td align="center">';          $SaleID = $row["SaleID"];                   echo $SaleID. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Category = $row["Category"];                   echo $Category. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Brand = $row["Brand"];                   echo $Brand. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Quantity = $row["Quantity"];                   echo $Quantity. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $PaidBy = $row["PaidBy"];                   echo $PaidBy. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $Cost = $row["Cost"];                   echo $Cost. "<br>";                   echo'</td align="center">';          echo'<td align="center">';          $SaleDate = $row["SaleDate"];                   echo $SaleDate. "<br>";                   echo'</td align="center">';                   echo '</tr>';      }    echo'</table>';        echo 'Go back <a href="index.php">Here</a> for another search.';    } } ?>


I hope I provided clear information...
Oct 7 '08
16 2779
pbmods
5,821 Recognized Expert Expert
Try passing 'action=allsale stoday' (etc.) as the third parameter to getPagingLink() .

It looks like anything you put in the third parameter ($strGet) gets dumped right into the paging link.
Oct 9 '08 #11
gnawz
64 New Member
Thanks, Sir

I always get criticism here. We can not be perfect all at once.

I will try that and get back to you.
But remember, I do not want to create another pagination function-I want to use the same (single function) in all pages. I hope I can achieve that in this case.
I have also improved my code.
I will post again.


Try passing 'action=allsale stoday' (etc.) as the third parameter to getPagingLink() .

It looks like anything you put in the third parameter ($strGet) gets dumped right into the paging link.
Oct 9 '08 #12
gnawz
64 New Member
The following is my pagination function which I use in pages with one function and it works well.
Expand|Select|Wrap|Line Numbers
  1. <?
  2. function getPagingQuery($sql, $itemPerPage = 10)
  3. {
  4.     if (isset($_GET['page']) && (int)$_GET['page'] > 0) 
  5.     {
  6.         $page = (int)$_GET['page'];
  7.     } 
  8.     else 
  9.     {
  10.         $page = 1;
  11.     }
  12.  
  13.     // start fetching from this row number
  14.     $offset = ($page - 1) * $itemPerPage;
  15.  
  16.     return $sql . " LIMIT $offset, $itemPerPage";
  17. }
  18.  
  19. /*
  20.     Get the links to navigate between one result page to another.
  21.  
  22. */
  23.  
  24.  
  25. function getPagingLink($sql, $itemPerPage = 10, $strGet = '')
  26. {
  27.     $result        = dbQuery($sql);
  28.     $pagingLink    = '';
  29.     $totalResults  = dbNumRows($result);
  30.     $totalPages    = ceil($totalResults / $itemPerPage);
  31.  
  32.     // how many link pages to show
  33.     $numLinks      = 10;
  34.  
  35.  
  36.     // create the paging links only if theres more than one page of results
  37.     if ($totalPages > 1) {
  38.  
  39.         $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ;
  40.  
  41.  
  42.         if (isset($_GET['page']) && (int)$_GET['page'] > 0) {
  43.             $pageNumber = (int)$_GET['page'];
  44.         } else {
  45.             $pageNumber = 1;
  46.         }
  47.  
  48.         // print 'previous' link only if its not
  49.         // on page one
  50.         if ($pageNumber > 1) {
  51.             $page = $pageNumber - 1;
  52.             if ($page > 1) {
  53.                 $prev = " <a href=\"$self?page=$page&$strGet/\">[Prev]</a> ";
  54.             } else {
  55.                 $prev = " <a href=\"$self?$strGet\">[Prev]</a> ";
  56.             }    
  57.  
  58.             $first = " <a href=\"$self?$strGet\">[First]</a> ";
  59.         } else {
  60.             $prev  = ''; // on page one, don't show 'previous' link
  61.             $first = ''; // nor 'first page' link
  62.         }
  63.  
  64.         // print 'next' link only if its not
  65.         // on the last page
  66.         if ($pageNumber < $totalPages) {
  67.             $page = $pageNumber + 1;
  68.             $next = " <a href=\"$self?page=$page&$strGet\">[Next]</a> ";
  69.             $last = " <a href=\"$self?page=$totalPages&$strGet\">[Last]</a> ";
  70.         } else {
  71.             $next = ''; // if on the last page, don't show 'next' link
  72.             $last = ''; // nor 'last page' link
  73.         }
  74.  
  75.         $start = $pageNumber - ($pageNumber % $numLinks) + 1;
  76.         $end   = $start + $numLinks - 1;        
  77.  
  78.         $end   = min($totalPages, $end);
  79.  
  80.         $pagingLink = array();
  81.         for($page = $start; $page <= $end; $page++)    {
  82.             if ($page == $pageNumber) {
  83.                 $pagingLink[] = " $page ";   // no need to create a link to current page
  84.             } else {
  85.                 if ($page == 1) {
  86.                     $pagingLink[] = " <a href=\"$self?$strGet\">$page</a> ";
  87.                 } else {    
  88.                     $pagingLink[] = " <a href=\"$self?page=$page&$strGet\">$page</a> ";
  89.                 }    
  90.             }
  91.  
  92.         }
  93.  
  94.         $pagingLink = implode(' | ', $pagingLink);
  95.  
  96.         // return the page navigation link
  97.         $pagingLink = $first . $prev . $pagingLink . $next . $last;
  98.     }
  99.  
  100.     return $pagingLink;
  101. }
  102.  
I want to use it in each and every function of the following page.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3. require_once '../../functions.php';
  4.  
  5.  
  6.  
  7. $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI'];
  8. checkUser();
  9.  
  10. $action = isset($_GET['action']) ? $_GET['action'] : '';
  11.  
  12. switch ($action) 
  13. {
  14.     case 'month' :
  15.         sales_Month();
  16.     break;
  17.  
  18.         case 'days' :
  19.         allsales_Day();
  20.  
  21.     case 'salesbybrand' :
  22.         salesbyBrand();
  23.     break;
  24.  
  25. default :
  26. }
  27.  
  28. function allsales_Day()
  29. {
  30.  
  31.     $day = '';
  32.     if (isset($_POST['sltallSales'])) $day = $_POST['sltallSales'];
  33.     elseif (isset($_GET['search'])) $day = $_GET['search'];
  34.  
  35.     $sql = "SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL '$day' DAY) <= SaleDate";
  36.  
  37.     $result = dbQuery($sql, "search=$day");
  38.  
  39.     if (dbNumRows($result) == 0) //if none    
  40.     {
  41.           echo '<p><font color=#CC0000><h4>No sales were found in the records...</h4></font></p>';
  42.         echo '<h4><a href="index.php">Back</a> to sales panel.';
  43.     }
  44.     else
  45.     {
  46.         //echo "<h5>Today's sales:<p></h5>";
  47.         echo '<table width="100%"  border="1" bordercolor="#000000">';
  48.           echo'<tr>';
  49.         echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';
  50.         echo'<th scope="col" bgcolor="#66FFFF">Category</th>';
  51.         echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';
  52.         echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';
  53.         echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';
  54.         echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';
  55.         echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';
  56.          echo'</tr>';
  57.       while($row = dbFetchArray($result))
  58.      // while($row = mysql_fetch_array($result))
  59.       {
  60.  
  61.          echo'<tr>';
  62.             echo'<td align="center">';
  63.             $SaleID = $row["SaleID"];
  64.                         echo $SaleID. "<br>";
  65.                         echo'</td align="center">';
  66.             echo'<td align="center">';
  67.             $Category = $row["Category"];
  68.                         echo $Category. "<br>";
  69.                         echo'</td align="center">';
  70.             echo'<td align="center">';
  71.             $Brand = $row["Brand"];
  72.                         echo $Brand. "<br>";
  73.                         echo'</td align="center">';
  74.             echo'<td align="center">';
  75.             $Quantity = $row["Quantity"];
  76.                         echo $Quantity. "<br>";
  77.                         echo'</td align="center">';
  78.             echo'<td align="center">';
  79.             $PaidBy = $row["PaidBy"];
  80.                         echo $PaidBy. "<br>";
  81.                         echo'</td align="center">';
  82.             echo'<td align="center">';
  83.             $Cost = $row["Cost"];
  84.                         echo $Cost. "<br>";
  85.                         echo'</td align="center">';
  86.             echo'<td align="center">';
  87.             $SaleDate = $row["SaleDate"];
  88.                         echo $SaleDate. "<br>";
  89.                         echo'</td align="center">';
  90.  
  91.           echo '</tr>';
  92.  
  93.       }
  94.     echo'</table>';
  95.  
  96.     echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>";
  97.  
  98.     $sql_total = "SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL '$day' DAY) <= SaleDate GROUP BY PaidBy";
  99.  
  100.     $result = dbQuery($sql_total);
  101.  
  102.  
  103.  
  104.     while($row = dbFetchArray($result))
  105.           {
  106.          echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> =  Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>";
  107.         echo "&nbsp;&nbsp;"; echo"|"; echo "&nbsp;&nbsp;";
  108.         }
  109.  
  110.     $sql_total_final = "SELECT SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL '$day' DAY) <= SaleDate";
  111.  
  112.     $result = dbQuery($sql_total_final);
  113.     while($row = dbFetchArray($result))
  114.           {
  115.         echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ;
  116.         }    
  117.  
  118.     echo "<br>"; 
  119.     echo '<h4><a href="index.php">Back</a> to sales panel.';
  120.     }
  121. }
  122.  
  123. function salesbyBrand()
  124. {
  125.     $byBrand = '';
  126.  
  127.     if (isset($_POST['sltBrand'])) $byBrand = $_POST['sltBrand'];
  128.     elseif (isset($_GET['search'])) $byBrand = $_GET['search'];
  129.  
  130.     $sql = "SELECT * FROM cstocksales WHERE Brand = '$byBrand'";
  131.  
  132.     $result = dbQuery($sql, "search=$byBrand");
  133.  
  134.     if (dbNumRows($result) == 0) //if none    
  135.     {
  136.           echo "<p><font color=#CC0000><h4>No sales for '$byBrand' were found in the records...</h4></font></p>";
  137.         echo "<h4><a href='index.php'>Back</a> to sales panel.";
  138.     }
  139.     else
  140.     {
  141.         echo '<h5>"'.$_POST['sltBrand'].'" slaes:<p></h5>';
  142.         echo '<table width="100%"  border="1" bordercolor="#000000">';
  143.           echo'<tr>';
  144.         echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';
  145.         echo'<th scope="col" bgcolor="#66FFFF">Category</th>';
  146.         echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';
  147.         echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';
  148.         echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';
  149.         echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';
  150.         echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';
  151.         echo'</tr>';
  152.  
  153.           while($row = dbFetchArray($result))
  154.           {
  155.              echo'<tr>';
  156.             echo'<td align="center">';
  157.             $SaleID = $row["SaleID"];
  158.                         echo $SaleID. "<br>";
  159.                         echo'</td align="center">';
  160.             echo'<td align="center">';
  161.             $Category = $row["Category"];
  162.                         echo $Category. "<br>";
  163.                         echo'</td align="center">';
  164.             echo'<td align="center">';
  165.             $Brand = $row["Brand"];
  166.                         echo $Brand. "<br>";
  167.                         echo'</td align="center">';
  168.             echo'<td align="center">';
  169.             $Quantity = $row["Quantity"];
  170.                         echo $Quantity. "<br>";
  171.                         echo'</td align="center">';
  172.             echo'<td align="center">';
  173.             $PaidBy = $row["PaidBy"];
  174.                         echo $PaidBy. "<br>";
  175.                         echo'</td align="center">';
  176.             echo'<td align="center">';
  177.             $Cost = $row["Cost"];
  178.                         echo $Cost. "<br>";
  179.                         echo'</td align="center">';
  180.             echo'<td align="center">';
  181.             $SaleDate = $row["SaleDate"];
  182.                         echo $SaleDate. "<br>";
  183.                         echo'</td align="center">';
  184.  
  185.           echo '</tr>';
  186.           }
  187.             echo'</table>';
  188.  
  189.             echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>";
  190.  
  191.             $sql_total = "SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE Brand = '$byBrand' GROUP BY PaidBy";
  192.  
  193.             $result = dbQuery($sql_total);
  194.  
  195.             while($row = dbFetchArray($result))
  196.               {
  197.             echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> =  Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>"    ;
  198.             echo "&nbsp;&nbsp;"; echo"|"; echo "&nbsp;&nbsp;";
  199.             }
  200.  
  201.             $sql_total_final = "SELECT SUM(Cost) FROM cstocksales WHERE Brand = '$byBrand'";
  202.  
  203.             $result = dbQuery($sql_total_final);
  204.             while($row = dbFetchArray($result))
  205.               {
  206.             echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ;
  207.             }
  208.  
  209.             echo "<br>"; 
  210.             echo '<h4><a href="index.php">Back</a> to sales panel.';
  211.     }
  212. }
  213.  
  214.  
  215. function sales_Month()
  216. {
  217.  
  218.     $month = $_POST['MonthSales'];
  219.  
  220.     $sql = "SELECT * FROM cstocksales WHERE MONTH(SaleDate) = '$month' AND YEAR(SaleDate) = YEAR(CURDATE())";
  221.  
  222.     $result = dbQuery($sql);
  223.     ///$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));
  224.     //$pagingLink = getPagingLink($sql, $rowsPerPage);
  225.  
  226.     if (dbNumRows($result) == 0) //if none    
  227.     {
  228.           echo '<p><font color=#CC0000><h4>No sales were found in the records...</h4></font></p>';
  229.         echo '<h4><a href="index.php">Back</a> to sales panel.';
  230.     }
  231.     else
  232.     {
  233.         echo '<h5>January sales:<p></h5>';
  234.         echo '<table width="100%"  border="1" bordercolor="#000000">';
  235.           echo'<tr>';
  236.         echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>';
  237.         echo'<th scope="col" bgcolor="#66FFFF">Category</th>';
  238.         echo'<th scope="col" bgcolor="#66FFFF">Brand</th>';
  239.         echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>';
  240.         echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>';
  241.         echo'<th scope="col" bgcolor="#66FFFF">Amount </th>';
  242.         echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>';
  243.      echo'</tr>';
  244.       while($row = dbFetchArray($result))
  245.       {
  246.          echo'<tr>';
  247.             echo'<td align="center">';
  248.             $SaleID = $row["SaleID"];
  249.                         echo $SaleID. "<br>";
  250.                         echo'</td align="center">';
  251.             echo'<td align="center">';
  252.             $Category = $row["Category"];
  253.                         echo $Category. "<br>";
  254.                         echo'</td align="center">';
  255.             echo'<td align="center">';
  256.             $Brand = $row["Brand"];
  257.                         echo $Brand. "<br>";
  258.                         echo'</td align="center">';
  259.             echo'<td align="center">';
  260.             $Quantity = $row["Quantity"];
  261.                         echo $Quantity. "<br>";
  262.                         echo'</td align="center">';
  263.             echo'<td align="center">';
  264.             $PaidBy = $row["PaidBy"];
  265.                         echo $PaidBy. "<br>";
  266.                         echo'</td align="center">';
  267.             echo'<td align="center">';
  268.             $Cost = $row["Cost"];
  269.                         echo $Cost. "<br>";
  270.                         echo'</td align="center">';
  271.             echo'<td align="center">';
  272.             $SaleDate = $row["SaleDate"];
  273.                         echo $SaleDate. "<br>";
  274.                         echo'</td align="center">';
  275.  
  276.           echo '</tr>';
  277.       }
  278.     echo'</table>';
  279.  
  280.     echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>";
  281.  
  282.     $sql_total = "SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE MONTH(SaleDate) = '$month' 
  283.                     AND YEAR(SaleDate) = YEAR(CURDATE()) GROUP BY PaidBy";
  284.  
  285.     $result = dbQuery($sql_total);
  286.  
  287.  
  288.  
  289.     while($row = dbFetchArray($result))
  290.           {
  291.          echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> =  Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>";
  292.         echo "&nbsp;&nbsp;"; echo"|"; echo "&nbsp;&nbsp;";
  293.         }
  294.  
  295.     $sql_total_final = "SELECT SUM(Cost) FROM cstocksales WHERE MONTH(SaleDate) = '$month' 
  296.                         AND YEAR(SaleDate) = YEAR(CURDATE())";
  297.  
  298.     $result = dbQuery($sql_total_final);
  299.     while($row = dbFetchArray($result))
  300.           {
  301.         echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ;
  302.         }
  303.  
  304.     echo "<br>"; 
  305.     echo '<h4><a href="index.php">Back</a> to sales panel.';
  306.     }
  307. }
  308.  
  309. /* End of month sales*/
  310.  
  311. ?>
  312.  
Please help on how to go about this
Oct 9 '08 #13
pbmods
5,821 Recognized Expert Expert
Wherever you call getPagingLink() , set the third parameter to whatever value you want to set the action to:

Expand|Select|Wrap|Line Numbers
  1. $pagingLink = getPagingLink($sql, $rowsPerPage, 'action=allsalestoday');
  2.  
You'll need to specify a different action each time you call it, but this will add the action parameter to your paging links.
Oct 10 '08 #14
gnawz
64 New Member
Thanks for your help.

It added the action to the paging link when I look at the URL but I still get a blank page.

What could be the cause?
Oct 10 '08 #15
pbmods
5,821 Recognized Expert Expert
If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.
Oct 10 '08 #16
gnawz
64 New Member
If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.
I have my error capturing all turned on.
Oct 10 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3407
by: Sharif T. Karim | last post by:
Anyone know of a up-to-date tutorial for pagination where I can have it like: Prev 1 2 3 4 Next Thanks. -- Sharif T. Karim ....you don't know wrath yet...
1
5816
by: Kruq | last post by:
Is it possible to use pagination with DataList? Can't find it.. :( Kruq
2
2329
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't functioning or the $page variable isnt working in that part of the code... Below is the link to the working but broken page.. as well as the main part of my code... Hopefully someone can explain why the operators arent working or maybe see what i...
4
3647
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed and reaches a specific length, it terminates printing that page, prints a page number, and then begins to print the next page using the same header and format as the previous page. The page uses no tables or paragraph elements, only CSS. IOW, I...
2
1968
by: mitra4umohit | last post by:
Hi, I am very new to javascript programming. We are using JSP as UI and Servlet as controller. In our project we have requirement wherein I need to show result in form of list item/link in rows and if result has more than 5 rows there should be one more link on click of which it should go to page where we can have pagination for those results. Now this listing should be collapsible, means if user wishes he can collapse or expand...
3
6403
Unicron
by: Unicron | last post by:
Hi folks, I have been working on a property listing search for a company for a while now and have hit a roadblock. I have searched the net up and down. A lot of Google results lead to this site, but I have never been able to get it to work. Here's the setup- The user submits search criteria via POST. The results php page pulls the $_POST array and displays the results with pagination of 20 results per page with links for Next/Previous. ...
2
1858
by: s4lin | last post by:
problem is pagination not retaining data field i have form with general data field, and i need to select some option which is store in database, so i open another page with retrieving data from table with pagination form data's are retaining if i select from first page but data not retaining if i select option from other than 1st page. i m using hidden field in pagination page. Thanks stalin
3
1586
by: raaman rai | last post by:
Please help me with the following code. I have used this pagination script from the net and customized it but unfortunately it doesnt work as expected. The problem is, for the trial purpose i have 3 records in the table and i have set the limit value to 2 only for now (for trial). So it is expected that i have 2 records displayed in the first page and 1 record in the second page. The first two records are displayed normally with the NEXT link....
4
3575
by: ArizonaJohn | last post by:
Hello, The code below works great. The user enters a name into an HTML form, the code looks up a table with that name, and then that table is displayed. I am trying to use pagination with it, and the pagination almost works. The first page of the pagination works fine, but when I click on one of the links for one of the next pages, the page is blank. I have seen people mention this problem, and they have been told that a variable is...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.