[Openfirst-cvscommit] guestbook index.php,1.2,1.3
Brought to you by:
xtimg
From: <xt...@us...> - 2003-07-23 21:45:17
|
Update of /cvsroot/openfirst/guestbook In directory sc8-pr-cvs1:/tmp/cvs-serv4685 Modified Files: index.php Log Message: Add limiting of number of posts per page to guestbook, to enhance performance Index: index.php =================================================================== RCS file: /cvsroot/openfirst/guestbook/index.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.php 28 Jun 2003 01:35:42 -0000 1.2 --- index.php 23 Jul 2003 21:45:12 -0000 1.3 *************** *** 41,47 **** <?php mysql_select_db("$sqldatabase"); ! $query = "SELECT * FROM ofirst_guestbook ORDER BY guest;"; $result = mysql_query($query); if ($result) { while ($r = mysql_fetch_object($result)) { --- 41,63 ---- <?php mysql_select_db("$sqldatabase"); ! ! ! if((int)$_GET["perpage"] == 0) { $_GET["perpage"] = 5; } ! if((int)$_GET["start"] == 0) { $_GET["start"] = 0; } ! echo("<form action='./' method='get'> ! Start at posting <input type='text' name='start' value='" . $_GET["start"] ."' size='3'> ! showing <input type='text' name='perpage' value='" . $_GET["perpage"] ."' size='3'> posts per ! page ! <input type='submit' value='Show Posts'> ! </form>"); ! ! $query = "SELECT * FROM ofirst_guestbook ORDER BY guest LIMIT " . $_GET["start"] . ", " . $_GET["perpage"] . ";"; $result = mysql_query($query); + $querytotal = "SELECT * FROM ofirst_guestbook;"; + $resulttotal = mysql_query($querytotal); + + echo("There has been a total of " . mysql_num_rows($resulttotal) . " messages posted to this guestbook."); + if ($result) { while ($r = mysql_fetch_object($result)) { *************** *** 76,78 **** include("$footer"); ! ?> \ No newline at end of file --- 92,94 ---- include("$footer"); ! ?> |