$tempquery = " where " . substr($condistion, 4); } $start = $p->findStart($limit); $querycount = "select cd_id from tblcd " . $tempquery; $count = mysql_num_rows(mysql_query($querycount)); $pages = $p->findPages($count, $limit); if (isset($_GET['nav']) and is_numeric($_GET['nav'])) { $paging = "LIMIT " . $start . "," . $limit . " "; } else { $paging = "LIMIT 0," . $limit . " "; } $orderby = "ORDER BY cd_id DESC"; $products = $prod->getListProduct($orderby, $condistion, $paging); //echo mysql_error(); //echo $condistion; $page_list = $p->pageList(sqlInjection($_GET['nav']), $pages); ?> <style type="text/css"> ul.paging li a { background-color: #F8F8F8; border: 1px solid #E6E6E6; border-radius: 2px 2px 2px 2px; color: #666666; padding: 2px 6px; outline: medium none; text-decoration: none; } ul.paging li a:active { color: #0000CC; } ul.paging li a:hover, ul.paging li a.paging-active {
echo "<td colspan='4' style='background-image:url(../images/danhmuc.png)' height='30'><p style='color:#FFF; font-weight:bold; text-align:center' >Sách {$so['0']} ({$so['1']} sách) </p></td>"; echo "</tr>"; $stt = 0; while ($row = mysqli_fetch_row($result)) { if ($stt % 4 == 0) { echo "<tr>"; } echo "<td valign='top'>"; echo "<table align='center'>"; echo "<tr><td align='center'><p style='font-weight:bold '><a href='list_sach.php?mas={$row['0']}'><b>{$row['1']}</b></a></td></tr>"; echo "<tr><td align='center'><img width='140' height='140' src='../data/" . $row[7] . "'></td></tr>"; echo "<tr><td align='center'>{$row['3']}.000 VND<a href=addcart.php?item={$row['0']}><img src='../images/dathang.gif' alt='đặt hàng' width='20' height='16' align='right' ></a></td></tr>"; echo "</table>"; echo "</td>"; $stt++; if ($stt % 4 == 0) { echo "</tr>"; } } echo "</table>"; $pagelist = $p->pageList($_GET['page'], $pages); echo "<table align:'center' width='100%'>"; echo "<p align:'center'>"; echo "<td colspan='4' style='background-image:url(../images/danhmuc.png)' height='30'><p style='color:#FFF; font-weight:bold; text-align:center' >"; echo "Trang: {$pagelist} "; echo "</p>"; echo "</table>"; } else { echo "Không có sách!"; } }
function getListVoucher() { $p = new Pager(); /* Show many results per page? */ $limit = 100; /* Find the start depending on $_GET['page'] (declared if it's null) */ $start = $p->findStart($limit); /* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */ $count = mysql_num_rows(mysql_query("SELECT * FROM wp_voucher_post")); /* Find the number of pages based on $count and $limit */ $pages = $p->findPages($count, $limit); /* Now we use the LIMIT clause to grab a range of rows */ $result = mysql_query("SELECT * FROM wp_voucher_post LIMIT " . $start . ", " . $limit); /* Now get the page list and echo it */ $pagelist = $p->pageList($_GET['page'], $pages); echo $pagelist; }