well in my code i have a pager, but when i have many information it become too long so much that I can’t go back to the first page, i need make it like a google pager .
i tried to reduce the variable $total_paginas but it didnt work, i saw some videos about this it, i cant found the solution.
0){
while($data = mysqli_fetch_array($query)){
if($data[‘estatus’] == 1){
$estado = ‘Pagada’;
}else{
$estado = ‘Anulada’;
}
?>
<tr id="row_<?php echo $data["num_factura"]; ?>">
<td><?php echo $data["num_factura"]; ?></td>
<td><?php echo $data["fecha"]; ?></td>
<td><?php echo $data["cliente"]; ?></td>
<td><?php echo $data["vendedor"]; ?></td>
<td class="estado"><?php echo $estado; ?></td>
<td class="textright totalfactura"><span>COP.</span><?php echo $data["total_factura"]; ?></td>
<td>
<div class="div_acciones">
<div>
<button class="btn_view view_factura" type="button" cl="<?php echo $data["cod_cliente"]; ?>" f="<?php echo $data["num_factura"]; ?>"><i class="fas fa-eye"></i></button>
</div>
<div class="div_factura">
<button class="btn_anular anular_factura" fac="<?php echo $data["num_factura"]; ?>"><i class="fas fa-ban"></i></button>
</div>
</div>
</td>
</tr>
<?php
}
}
?>
</table>
<div class="paginador">
<ul>
<?php
if($pagina != 1){
?>
<li><a href="?pagina=<?php echo 1; ?>"><i class="fa-solid fa-backward-fast"></i></a></li>
<li><a href="?pagina=<?php echo $pagina - 1; ?>"><i class="fa-solid fa-backward"></i></a></li>
<?php
}
for ($i=1; $i <= $total_paginas ; $i++) {
if($i == $pagina){
echo '<li class="pageSelected">'.$i.'</a></li>';
}else{
echo '<li><a href="?pagina='.$i.'">'.$i.'</a></li>';
}
}
if($pagina != $total_paginas){
?>
<li><a href="?pagina=<?php echo $pagina + 1; ?>"><i class="fa-solid fa-forward"></i></a></li>
<li><a href="?pagina=<?php echo $total_paginas; ?>"><i class="fa-solid fa-forward-fast"></i></a></li>
<?php } ?>
</ul>
</div>
</section>
daniel hernandez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.