-1
I need to create a pagination for my database with 180 products, only the images without pagination appear all 180 side by side, as I can do to limit the images 10 per page side by side?
Here is my code:
<?php
echo'<table width="88%" height="10" cellspacing="0" cellpadding="0"><tr>';
$conn = new PDO("mysql:host=localhost;dbname=loja", "root", "");
$stmt = $conn->prepare("SELECT * FROM `produtos` ORDER BY `id` ASC ");
$stmt->execute( );
$linha = $stmt->fetch(PDO::FETCH_ASSOC);
while($linha = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo'<br>';
echo'<p><td align=center ><h2><font size="5" face="Trebuchet MS">'.$linha['nome'].'</font></font></p></h2>';
echo "<div align=center ><img src='".$linha['foto']."' width='160' height='160' border='0'></p>";
echo '<a href="carrinho.php?acao=add&id='.$linha['id'].'"><button type="button" name="" value="" class="quero">Eu Quero!</button>';
}
echo "</tr></table>";
?>
Related: How to limit the number of pages shown in a pagination?
– rray