Note that there are some explanatory texts on larger screens.

plurals
  1. POPagination For Admin Panel in PHP
    primarykey
    data
    text
    <p>i have no idea i tried to connect the DB with my panel but it gives some error any help would be appreciated...................................................................................................................</p> <pre><code>&lt;?php if (!(isset($pagenum))) { $pagenum = 1; } $qry = "SELECT * FROM posts LIMIT 0,3"; $result = mysqli_query($qry,$con); $rows = mysqli_num_rows($qry); $page_rows = 3; $last = ceil($rows/$page_rows); if ($pagenum &lt; 1) { $pagenum = 1; } elseif ($pagenum &gt; $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $j=0; $qry ="SELECT * FROM posts $max"; $result = mysqli_query($con,$qry); //This is where you display your query results while($rows = mysqli_fetch_array($result)) { $j++; echo "&lt;p&gt;"; // This shows the user what page they are on, and the total number Query and Results of pages echo " --Page $pagenum of $last-- &lt;p&gt;"; // First we check if we are on page one. If we are then we don't need a //link to the previous page or the first page so we do nothing. If we aren't //then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " &lt;a href='{$_SERVER['PHP_SELF']}?pagenum=1'&gt; &lt;&lt;-First&lt;/a&gt; "; echo " "; $previous = $pagenum-1; echo " &lt;a href='{$_SERVER['PHP_SELF']}? pagenum=$previous'&gt; &lt;-Previous&lt;/a&gt; "; } //just a spacer echo " ---- "; //This does the same as above, only checking if we are on the last page, //and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " &lt;a href='{$_SERVER['PHP_SELF']}?pagenum=$next'&gt;Next -&gt;&lt;/a&gt; "; echo " "; echo " &lt;a href='{$_SERVER['PHP_SELF']}?pagenum=$last'&gt;Last -&gt;&gt;&lt;/a&gt; "; } ?&gt; </code></pre>
    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.
 

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