CodingStudent Posted August 26, 2020 Share Posted August 26, 2020 Hi friends, i have a problem. i try to make pagination. I didn't added numbers and the number stayed next to the images. Numbers is no display and it is next the images. And i don't want to give "padding-left" for first image but when i use "padding-left" for images, it is giving all of them. <?php $sayfa = intval($_GET["sayfa"]); if(!$sayfa) {$sayfa = 1;} $say = $db->query("SELECT * FROM resimlerekle"); $toplamveri = $say->rowCount(); // Verileri Saydırdık $limit = 8; $sayfa_sayisi = ceil($toplamveri/$limit); if($sayfa > $sayfa_sayisi) { $sayfa = 1; } $goster = $sayfa * $limit - $limit; $gorunensayfa = 6; $resimcek = $db->query("SELECT * FROM resimlerekle ORDER BY cokluresimekle_id DESC LIMIT $goster,$limit"); $resimlerial = $resimcek->fetchAll(PDO::FETCH_ASSOC); ?> <?php foreach ($resimlerial as $resim) { ?> <div style="float: left; padding-left: 10px;"> <div><img <?php echo $resim; ?> style="max-width:250px;" src="../../../upload/cokluresim/<?php echo $resim["cokluresimekle_resim"]; ?>" ></div> <div style="max-width:250px; max-height:50px; background-color:#d6d4d4; line-height:50px; text-align:center;"><?php echo $resim['cokluresimekle_baslik']; ?></div> </div> <?php } ?> <!-- Benim Eklediğim Kodlar Bitiş --> <?php if ($sayfa > 1) { ?> <span><a href="index.php?sayfa=1">İlk</a></span> <div><a href="index.php?sayfa=<?php echo $sayfa - 1 ?>">Önceki</a></div> <?php } ?> <?php for($i = $sayfa - $gorunensayfa; $i < $sayfa + $gorunensayfa +1; $i++) { if($i > 0 and $i <= $sayfa_sayisi) { if($i == $sayfa) { echo '<span>'.$i.'</span>'; }else{ echo '<a href="index.php?sayfa='.$i.'">'.$i.'</a>'; } } } ?> <?php if ($sayfa != $sayfa_sayisi) { ?> <div><a href="index.php?sayfa=<?php echo $sayfa + 1 ?>">Sonraki</a></div> <div><a href="index.php?sayfa<?php echo $sayfa_sayisi ?>">Son</a></div> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/311398-in-pagination-a-problem/ Share on other sites More sharing options...
CodingStudent Posted August 27, 2020 Author Share Posted August 27, 2020 my just problem that. i didn't get the pagination down. Quote Link to comment https://forums.phpfreaks.com/topic/311398-in-pagination-a-problem/#findComment-1581012 Share on other sites More sharing options...
requinix Posted August 27, 2020 Share Posted August 27, 2020 It can be hard to know what the problem is when we cannot see the page in our own web browser, but You have float:left for your images but not for the pagination links. float is not very good and CSS has better options for how to display items. For example, try display:inline-block instead of float:left. Quote Link to comment https://forums.phpfreaks.com/topic/311398-in-pagination-a-problem/#findComment-1581018 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.