Note that there are some explanatory texts on larger screens.

plurals
  1. POIf I already have a table of tickets set up to split into pages, how can I make it have page links at the bottom?
    primarykey
    data
    text
    <blockquote> <p><strong>This question is answered. <a href="https://stackoverflow.com/questions/7465147/if-i-already-have-a-table-of-tickets-set-up-to-split-into-pages-how-can-i-make-i/7506858#7506858">Click here</a> to see the answer that answered my question.</strong></p> </blockquote> <p><hr /></p> <h2>Edit:</h2> <p>I still don't know exactly how to do this. Could someone help? I get the fact that it's called "pagination" but I don't know how to make it display page links at the bottom. I hope someone will be able to help. <hr /> I have a table of tickets and all of the data is loaded in from a database to the table. I have pages on it (using <code>?page=1</code>, <code>?page=2</code>, etc.) but, how can I make it where it has "Next Page", "Previous Page", "Last Page", "Page <em>something</em> of <em>something</em>", etc. at the bottom?</p> <h3>The code that does it all is:</h3> <pre><code>&lt;table id="tickets"&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Email&lt;/th&gt; &lt;th&gt;Subject&lt;/th&gt; &lt;th&gt;Created on&lt;/th&gt; &lt;th style="width:65px;"&gt;Status&lt;/th&gt; &lt;th&gt;Actions&lt;/th&gt; &lt;/tr&gt;&lt;?php $startpoint = $_GET["page"]; if (isset($_GET["page"])) { $startpoint = $_GET["page"]; } else { $startpoint = 1; } $startpoint = $startpoint - 1; $startpoint = $startpoint * 10; $endpoint = $startpoint + 10; function addEllipsis($string, $length) { $end = "..."; if (strlen($string) &gt; $length) { $length -= strlen($end); // $length = $length – strlen($end); $string = substr($string, 0, $length); $string .= $end; // $string = $string . $end; } return $string; } $x = 1; if ($show == "active") { $result = mysql_query("SELECT * FROM tickets WHERE is_active='1'"); while ($info = mysql_fetch_array($result)) { $x++; $name = $info['name']; $email = $info['email']; $subject = $info['subject']; $ticketid = $info['ticket']; $isActive = $info['is_active']; $created = $info['created']; if ($isActive == '1') { $status = "&lt;span class=\"open\"&gt;Open&lt;/span&gt;"; } if ($isActive == '0') { $status = "&lt;span class=\"closed\"&gt;Closed&lt;/span&gt;"; } if ($x &gt; $startpoint &amp;&amp; $x &lt; $endpoint) { echo " &lt;tr&gt; &lt;td&gt;".$name."&lt;/td&gt; &lt;td&gt;".$email."&lt;/td&gt; &lt;td title=\"".$subject."\"&gt;".addEllipsis($subject, 16)."&lt;/td&gt; &lt;td&gt;".$created."&lt;/td&gt; &lt;td&gt;".$status."&lt;/td&gt; &lt;td&gt;&lt;a href=\"/employee/employee.php?ticket=".$ticketid."\"&gt;View ticket &amp;raquo;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;"; } } } else if ($show == "closed") { $result = mysql_query("SELECT * FROM tickets WHERE is_active='0'"); while ($info = mysql_fetch_array($result)) { $x++; $name = $info['name']; $email = $info['email']; $subject = $info['subject']; $ticketid = $info['ticket']; $isActive = $info['is_active']; $created = $info['created']; if ($isActive == '1') { $status = "&lt;span class=\"open\"&gt;Open&lt;/span&gt;"; } if ($isActive == '0') { $status = "&lt;span class=\"closed\"&gt;Closed&lt;/span&gt;"; } if ($x &gt; $startpoint &amp;&amp; $x &lt; $endpoint) { echo " &lt;tr&gt; &lt;td&gt;".$name."&lt;/td&gt; &lt;td&gt;".$email."&lt;/td&gt; &lt;td title=\"".$subject."\"&gt;".addEllipsis($subject, 16)."&lt;/td&gt; &lt;td&gt;".$created."&lt;/td&gt; &lt;td&gt;".$status."&lt;/td&gt; &lt;td&gt;&lt;a href=\"/employee/employee.php?ticket=".$ticketid."\"&gt;View ticket &amp;raquo;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;"; } } } else { $result = mysql_query("SELECT * FROM tickets"); while ($info = mysql_fetch_array($result)) { $x++; $name = $info['name']; $email = $info['email']; $subject = $info['subject']; $ticketid = $info['ticket']; $isActive = $info['is_active']; $created = $info['created']; if ($isActive == '1') { $status = "&lt;span class=\"open\"&gt;Open&lt;/span&gt;"; } if ($isActive == '0') { $status = "&lt;span class=\"closed\"&gt;Closed&lt;/span&gt;"; } if ($x &gt; $startpoint &amp;&amp; $x &lt; $endpoint) { echo " &lt;tr&gt; &lt;td&gt;".$name."&lt;/td&gt; &lt;td&gt;".$email."&lt;/td&gt; &lt;td title=\"".$subject."\"&gt;".addEllipsis($subject, 16)."&lt;/td&gt; &lt;td&gt;".$created."&lt;/td&gt; &lt;td&gt;".$status."&lt;/td&gt; &lt;td&gt;&lt;a href=\"/employee/employee.php?ticket=".$ticketid."\"&gt;View ticket &amp;raquo;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;"; } } } ?&gt; &lt;/table&gt; </code></pre> <p>How could I make it show links to the each page (just a simple "1", "2", etc.) at the bottom? I can't create them myself because I wont know how much pages there is and stuff. It would also be great if the link could turn into grey non-clickable text when you are on that certain page. Someone helped me with the page feature but they aren't online right so they can't help me. (I'm not that good at PHP yet) Anyone know how to accomplish this?</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.
 

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