Skip to main content
July 6, 2010
Question

Page Numbering

  • July 6, 2010
  • 1 reply
  • 435 views

Hi Chaps,

I have a DreamWeaver Query, that selects data from MySQL database:

Code:

$maxRows_rsShop = 20;
$pageNum_rsShop = 0;
if (isset($_GET['pageNum_rsShop'])) {
  $pageNum_rsShop = $_GET['pageNum_rsShop'];
}
$startRow_rsShop = $pageNum_rsShop * $maxRows_rsShop;

$colname_rsShop = "-1";
if (isset($_GET['shop'])) {
  $colname_rsShop = $_GET['shop'];
}
mysql_select_db($database_dbconnect, $dbconnect);
$query_rsShop = sprintf("
SELECT     tbl_shop.shop_title,               
                tbl_product.prod_id,               
                tbl_product.prodtitle,               
                tbl_product.prod_shop_thumb,               
                tbl_product.prod_price,               
                tbl_product_type.prod_type_title,               
                tbl_product_type.prod_type_plural,               
                SUM(tbl_product_type.prod_type_id) as quantity,
                img_name
FROM       tbl_shop_has_prod
INNER JOIN         tbl_shop               
                ON tbl_shop.shop_id=tbl_shop_has_prod.FK_shop_id
INNER JOIN         tbl_product               
                ON tbl_product.prod_id=tbl_shop_has_prod.FK_prod_id
INNER JOIN         tbl_product_type               
                ON tbl_product_type.prod_type_id=tbl_product.FK_prod_type_id
INNER JOIN         tbl_product_has_size               
                ON tbl_product_has_size.FK_prod_id=tbl_product.prod_id
INNER JOIN        tbl_web_img
                ON tbl_web_img.FK_shop_id=tbl_shop.shop_id
WHERE            shop_id=%s               
                AND prod_quantity > 0
GROUP BY         shop_id,               
                prod_id
ORDER BY        prod_added DESC", GetSQLValueString($colname_rsShop, "int"));
$query_limit_rsShop = sprintf("%s LIMIT %d, %d", $query_rsShop, $startRow_rsShop, $maxRows_rsShop);
$rsShop = mysql_query($query_limit_rsShop, $dbconnect) or die(mysql_error());
$row_rsShop = mysql_fetch_assoc($rsShop);

if (isset($_GET['totalRows_rsShop'])) {
  $totalRows_rsShop = $_GET['totalRows_rsShop'];
} else {
  $all_rsShop = mysql_query($query_rsShop);
  $totalRows_rsShop = mysql_num_rows($all_rsShop);
}
$totalPages_rsShop = ceil($totalRows_rsShop/$maxRows_rsShop)-1;


$queryString_rsShop = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_rsShop") == false &&
        stristr($param, "totalRows_rsShop") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_rsShop = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_rsShop = sprintf("&totalRows_rsShop=%d%s", $totalRows_rsShop, $queryString_rsShop);

I have 'Move to Fist Page', 'Move to Previous Page', 'Move to Next Page', 'Move to Last Page' links that work OK, but what I'm after is page numbering links so the user knows how many pages there are, i.e.: 1, 2, 3.

I can't find a solution within DreamWeaver itself, if I've missed it can someone tell me where I might need to look. If it is not built into DreamWeaver, is there a workaround/other solution?

This topic has been closed for replies.

1 reply

Participant
July 6, 2010

I once found an extension of Tom Muck about it.

I never tried this myself but I use his horizontal looper and that works great.

The link:

http://www.tom-muck.com/extensions/help/RecordsetNavigationSuite/

Best regards

July 6, 2010

Top stuff, easy to implement, exactly what I was after, many thanks!