cvs: phpweb / bugs.php

From: Date: Sat, 07 Jul 2001 20:56:01 +0000
Subject: cvs: phpweb / bugs.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-5308@lists.php.net to get a copy of this message
jimw Sat Jul 7 16:56:01 2001 EDT Modified files: /phpweb bugs.php Log: chunk output to 30 bugs at a time Index: phpweb/bugs.php diff -u phpweb/bugs.php:1.135 phpweb/bugs.php:1.136 --- phpweb/bugs.php:1.135 Sat Jul 7 16:39:02 2001 +++ phpweb/bugs.php Sat Jul 7 16:56:00 2001 @@ -161,16 +161,21 @@ $query .= " ORDER BY $order_by $direction"; + if (!$begin) $begin = 0; + $query .= " LIMIT $begin,30"; + $res = @mysql_query($query); if (!$res) die(htmlspecialchars($query)."<br>".mysql_error()); - if (!mysql_numrows($res)) { + $rows = mysql_numrows($res); + if (!$rows) { echo "<h2 class=\"error\">No bugs with the specified criteria were found.</h2>"; } else { $link = "$PHP_SELF?cmd=display&amp;bug_type=$bug_type&amp;status=$status&amp;search_for=".htmlspecialchars(stripslashes($search_for))."&amp;bug_age=$bug_age&amp;by=$by&amp;order_by=$order_by&amp;direction=$direction"; ?> <table align="center" border="0" cellspacing="2" width="95%"> + <?php show_prev_next($begin,$rows,$link);?> <tr bgcolor="#aaaaaa"> <th><a href="<?php echo $link;?>&amp;reorder_by=id">ID#</a></th> <?php if ($bug_type == "Any") {?> @@ -201,6 +206,8 @@ echo "<td>",$row[assigned] ? htmlspecialchars($row[assigned]) : "&nbsp;","</td>"; echo "</tr>\n"; } + + show_prev_next($begin,$rows,$link); ?> </table> <?php @@ -703,6 +710,19 @@ return "#aaaaaa"; break; } +} + +function show_prev_next($begin,$rows,$link) { + if ($begin == 0 && $rows < 30) return; + echo "<tr bgcolor=\"#cccccc\"><td align=\"center\" colspan=\"9\">"; + echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>'; + if ($begin > 0) { + echo "<td align=\"left\"><a href=\"$link&amp;begin=",max(0,$begin-30),"\">&laquo; Show Previous 30 Entries</a></td>"; + } + if ($rows >= 30) { + echo "<td align=\"right\"><a href=\"$link&amp;begin=",$begin+30,"\">Show Next 30 Entries &raquo;</a></td>"; + } + echo "</tr></table></td></tr>"; } /*

« previous php.mirrors (#5308) next »