Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include 'includes/connection.php';
- $sql = mysqli_query($conn,"SELECT id, cve_prod, desc_prod FROM abb ORDER BY id ASC");
- $nr = mysqli_num_rows($sql);
- if (isset($_GET['pn'])) {
- $pn = preg_replace('#[^0-9]#i', '', $_GET['pn']);
- } else {
- $pn = 1;
- }
- $itemsPerPage = 10;
- $lastPage = ceil($nr / $itemsPerPage);
- if ($pn < 1) {
- $pn = 1;
- } else if ($pn > $lastPage) {
- $pn = $lastPage;
- }
- $centerPages = "";
- $sub1 = $pn - 1;
- $sub2 = $pn - 2;
- $add1 = $pn + 1;
- $add2 = $pn + 2;
- $display = 'productos.html';
- if ($pn == 1) {
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $display . '?pn=' . $add1 . '">' . $add1 . '</a> ';
- } else if ($pn == $lastPage) {
- $centerPages .= ' <a href="' . $display . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- } else if ($pn > 2 && $pn < ($lastPage - 1)) {
- $centerPages .= ' <a href="' . $display . '?pn=' . $sub2 . '">' . $sub2 . '</a> ';
- $centerPages .= ' <a href="' . $display . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $display . '?pn=' . $add1 . '">' . $add1 . '</a> ';
- $centerPages .= ' <a href="' . $display . '?pn=' . $add2 . '">' . $add2 . '</a> ';
- } else if ($pn > 1 && $pn < $lastPage) {
- $centerPages .= ' <a href="' . $display . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $display . '?pn=' . $add1 . '">' . $add1 . '</a> ';
- }
- $limit = 'LIMIT ' .($pn - 1) * $itemsPerPage .',' .$itemsPerPage;
- $sql2 = mysqli_query($conn,"SELECT id, cve_prod, desc_prod FROM abb ORDER BY id ASC $limit");
- $paginationDisplay = "";
- if ($lastPage != "1"){
- $paginationDisplay .= 'Página <strong>' . $pn . '</strong> de ' . $lastPage. ' ';
- if ($pn != 1) {
- $previous = $pn - 1;
- $paginationDisplay .= ' <script>$("#home").show();$("#framecontent2").show();$("#framecontent3").show();</script> <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '"> Atras</a> ';
- }
- $paginationDisplay .= '<span class="paginationNumbers">' . $centerPages . '</span>';
- if ($pn != $lastPage) {
- $nextPage = $pn + 1;
- $paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $nextPage . '"> Siguiente</a> ';
- }
- }
- $outputList = '';
- while($row = mysqli_fetch_array($sql2)){
- $id = $row["id"];
- $cve_prod = $row["cve_prod"];
- $desc_prod = $row["desc_prod"];
- $outputList .= "<br/><div style='display:inline-block; width:150px; margin-left:5px;'>" . $cve_prod ."</div>" . " " . "<div style='display:inline-block;margin-left:92px; margin-right:64px;'>" . $desc_prod ."</div><br/>" ;
- }
- ?>
- <html>
- <head>
- <meta charset="utf-8">
- <title>JR COMMICH</title>
- <link rel="stylesheet" href="css/style.css">
- <link rel="stylesheet" href="css/bootstrap.css">
- <link rel="stylesheet" href="css/jquery-ui-1.9.2.custom.css">
- <script type="text/javascript">
- $("#home").hide();
- $("#framecontent2").hide();
- $("#framecontent3").hide();
- </script>
- </head>
- <body style="background:#eee url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAMAAAC6sdbXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF3d3d////riJKgAAAAAJ0Uk5T/wDltzBKAAAAFUlEQVR42mJgBAEGGMmAxAYCgAADAAGGABmnk/7aAAAAAElFTkSuQmCC);">
- <!-- <div id="framecontent2">
- <div class="innertube"></div>
- </div>
- <div id="framecontent3">
- <div class="innertube"></div>
- </div>
- <!-- INICIO DEL MENU -->
- <!--FIN DEL MENU -->
- <div style="margin-left:64px; margin-right:64px;">
- <h2 style="font-size:26px;color:#b3292e;">ABB <p style=" display:inline-block;color:black;"> - Artículos:<?php echo $nr; ?> - </p> JR Una Nube de Soluciones para el Integrador</h2>
- </div>
- <div id="maincontent3" style="background-image:url('logo_nube2.png'); background-position:center; background-size:516px 395px; background-repeat:no-repeat;">
- <div style="margin-left:220px; margin-right:220px; padding:6px; border:#b3292e 2px solid; border-radius:10px; font-weight:bold;"><?php echo "" . $paginationDisplay; ?></div><br>
- <div style="margin-left:226px; margin-right:226px;"><div style="color:#b3292e; display:inline-block; width:200px; font-size:30px;">Clave</div><div style=" color:#b3292e;margin-left:65px; display:inline-block; width:250px; font-size:30px;">Descripcion</div></div>
- <div style="margin-left:226px; margin-right:100px; margin-bottom:40px; font-weight:bold;"><?php print "$outputList"; ?></div> <br>
- <div style="margin-left:220px; margin-right:220px; padding:6px; font-weight:bold; border:#b3292e 2px solid; border-radius:10px; "><?php echo $paginationDisplay; ?></div>
- </div>
- <div id="home" style="margin-left:220px; margin-right:220px; padding:6px; font-weight:bold;"><a href="productos.html">Regresar al catálogo</a></div>
- <!-- FOOTER -->
- <!-- <div class="navbar navbar-inverse navbar-fixed-bottom">
- <div class="container">
- <p class="navbar-text pull-left italic">ventas@ | (55) | <a href="aviso_privacidad.html">Aviso de Privacidad</a> </p>
- <p class="navbar-text pull-right">© Copyright 2013 DERECHOS RESERVADOS </p>
- </div>
- </div>
- <!-- FOOTER ENDS -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement