williamh26 Posted November 7, 2012 Share Posted November 7, 2012 Hi guy I am trying to get the pagination right. this is my code <?php echo"<img src='images/banner/ribbon.jpg' align='center' width='500' height='100' alt=''/>"; $categoria_id = $_GET['cat']; $query = "Select count(categoria_id) from categoria where categoria_id = $categoria_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); if (mysql_num_rows($result) > 0) { $per_page = 7; $pages_query = mysql_query("SELECT COUNT(nombre) from productos WHERE categoria_id=$categoria_id"); $pages = ceil (mysql_result($pages_query, 0)/$per_page) ; $page = (isset($_GET['page'])) ? (int)$_GET['page']: 1; $start = ($page - 1) * $per_page; $sql = mysql_query("SELECT * from productos WHERE categoria_id=$categoria_id LIMIT $start, $per_page"); while($row = mysql_fetch_array($sql)){ $nombre = $row['nombre']; $descripcion = $row['descripcion']; $precio = $row['precio']; $imagen = $row['imagen']; echo"<ul class=leaders>"; echo"<li><span><a href='images/platos/$imagen.jpg' rel='prettyPhoto[gallery4]' title='$nombre $descripcion' width='489' height='720'><img src='images/platos/$imagen.jpg' rel='prettyPhoto[gallery3]' align='left' width='105' height='90' alt=''/><strong> $nombre</strong></a></span>"; echo"<span>$ $precio</span></li>"; echo"</ul>"; } if($pages >=1 && $page <= $pages) { for ($x =1; $x<=$pages; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ': '<a href="?page='.$x.'">'.$x.'</a> '; } } } ?> the problem is that when I click for example page number two in the pagination it shows me the index page... How I FIXT IT... OH something else... how i erase the <li> dots?? I am trying with css but with not results. THANKS IN ADVANCED Link to comment https://forums.phpfreaks.com/topic/270383-pagination/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.