Jump to content

In Pagination a Problem


CodingStudent

Recommended Posts

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 } ?>

4NxnLZ.jpg

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.