Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to set pagination at the bottom of a div?
    primarykey
    data
    text
    <p>I have a problem with my pagination style... i want to set the pagination at the bottom of the div</p> <p><img src="https://i.stack.imgur.com/Yuhaa.jpg" alt="enter image description here"></p> <p>now my pagination is look like this,i would like to set the pagination at the bottom of the div and the position of pagination will not be fixed,if i change the <code>result_per_page</code> to 10 or more the pagination will automatically adjust its position at the bottom</p> <p>here is my pagination style</p> <pre><code>&lt;style&gt; .paginate { height:34px; position:relative; width:auto; display:inline-block; } .paginate a { padding:2px 5px 2px 5px; margin:2px; border:1px solid #999; text-decoration:none; color: #666; } .paginate a:hover, .paginate a:active { border: 1px solid #999; color:#0384DA } .paginate span.current { margin: 2px; padding: 2px 5px 2px 5px; border: 1px solid #0384DA; font-weight: bold; background-color: #0384DA; color: #FFF; } .paginate span.disabled { padding:2px 5px 2px 5px; margin:2px; border:1px solid #eee; color:#0384DA; } li{ padding:4px; margin-bottom:3px; background-color:#FCC; list-style:none;} ul{margin:6px; padding:0px;} &lt;/style&gt; </code></pre> <p>Contents inside the body</p> <pre><code> &lt;body&gt; &lt;?php $targetpage = "pagnate.php"; $limit = 10; $query = mysql_query("SELECT * FROM tblpropertyregister"); $total_pages = mysql_num_rows($query); $stages = 3; if (isset($_GET['page']) &amp;&amp; $_GET['page'] != '') { $page = $_GET['page']; $start = ($page - 1) * $limit; } else { $start = 0; } // Get page data $query1 = "SELECT * FROM tblpropertyregister LIMIT $start, $limit"; $result = mysql_query($query1); // Initial page num setup if ($page == 0) { $page = 1; } $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages / $limit); $LastPagem1 = $lastpage - 1; $paginate = ''; if ($lastpage &gt; 1) { $paginate .= "&lt;div class='paginate'&gt;"; // Previous if ($page &gt; 1) { $paginate.= "&lt;a href='$targetpage?page=$prev'&gt;previous&lt;/a&gt;"; } else { $paginate.= "&lt;span class='disabled'&gt;previous&lt;/span&gt;"; } // Pages if ($lastpage &lt; 7 + ($stages * 2)) { // Not enough pages to breaking it up for ($counter = 1; $counter &lt;= $lastpage; $counter++) { if ($counter == $page) { $paginate.= "&lt;span class='current'&gt;$counter&lt;/span&gt;"; } else { $paginate.= "&lt;a href='$targetpage?page=$counter'&gt;$counter&lt;/a&gt;"; } } } elseif ($lastpage &gt; 5 + ($stages * 2)) { // Enough pages to hide a few? // Beginning only hide later pages if ($page &lt; 1 + ($stages * 2)) { for ($counter = 1; $counter &lt; 4 + ($stages * 2); $counter++) { if ($counter == $page) { $paginate.= "&lt;span class='current'&gt;$counter&lt;/span&gt;"; } else { $paginate.= "&lt;a href='$targetpage?page=$counter'&gt;$counter&lt;/a&gt;"; } } $paginate.= "..."; $paginate.= "&lt;a href='$targetpage?page=$LastPagem1'&gt;$LastPagem1&lt;/a&gt;"; $paginate.= "&lt;a href='$targetpage?page=$lastpage'&gt;$lastpage&lt;/a&gt;"; } // Middle hide some front and some back elseif ($lastpage - ($stages * 2) &gt; $page &amp;&amp; $page &gt; ($stages * 2)) { $paginate.= "&lt;a href='$targetpage?page=1'&gt;1&lt;/a&gt;"; $paginate.= "&lt;a href='$targetpage?page=2'&gt;2&lt;/a&gt;"; $paginate.= "..."; for ($counter = $page - $stages; $counter &lt;= $page + $stages; $counter++) { if ($counter == $page) { $paginate.= "&lt;span class='current'&gt;$counter&lt;/span&gt;"; } else { $paginate.= "&lt;a href='$targetpage?page=$counter'&gt;$counter&lt;/a&gt;"; } } $paginate.= "..."; $paginate.= "&lt;a href='$targetpage?page=$LastPagem1'&gt;$LastPagem1&lt;/a&gt;"; $paginate.= "&lt;a href='$targetpage?page=$lastpage'&gt;$lastpage&lt;/a&gt;"; } // End only hide early pages else { $paginate.= "&lt;a href='$targetpage?page=1'&gt;1&lt;/a&gt;"; $paginate.= "&lt;a href='$targetpage?page=2'&gt;2&lt;/a&gt;"; $paginate.= "..."; for ($counter = $lastpage - (2 + ($stages * 2)); $counter &lt;= $lastpage; $counter++) { if ($counter == $page) { $paginate.= "&lt;span class='current'&gt;$counter&lt;/span&gt;"; } else { $paginate.= "&lt;a href='$targetpage?page=$counter'&gt;$counter&lt;/a&gt;"; } } } } // Next if ($page &lt; $counter - 1) { $paginate.= "&lt;a href='$targetpage?page=$next'&gt;next&lt;/a&gt;"; } else { $paginate.= "&lt;span class='disabled'&gt;next&lt;/span&gt;"; } $paginate.= "&lt;/div&gt;"; } echo $total_pages . ' Results'; // pagination echo $paginate; ?&gt; &lt;ul&gt; &lt;?php while ($row = mysql_fetch_array($result)) { echo '&lt;li&gt;' . $row['PropertyTitle'] . "- -" . $row['PropertyCode'] . '&lt;/li&gt;'; } ?&gt; &lt;/ul&gt; &lt;/body&gt; </code></pre> <p>Thanks in Advanse</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload