aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-06 15:44:38 -0300
committerSilvio <silvio@devlet.com.br>2010-08-06 15:44:38 -0300
commitbd60d89fc77e87a200bd6145ec894fe0a572a209 (patch)
treefc96b80f8eb7ded74d7d1da07ff679dd61eae80e
parent0006855f7d8508fc33d7fff107b42f7e062b891b (diff)
downloadcinisis-bd60d89fc77e87a200bd6145ec894fe0a572a209.tar.gz
cinisis-bd60d89fc77e87a200bd6145ec894fe0a572a209.tar.bz2
Minor fix and comments
-rw-r--r--tests/index.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/index.php b/tests/index.php
index c2b2e9d..ae12134 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -35,19 +35,25 @@ $isis = new CinisisDb();
// Setup database and entry number.
if ($isis->db) {
- $result = $isis->db->read($entry);
+ // Get the number of entries.
$entries = $isis->db->entries();
+ // Input sanitization.
if ($entries < $entry) {
$entry = 1;
}
+ // Query database.
+ $result = $isis->db->read($entry);
+
+ // First / prev links.
if ($entry != 1) {
$prev = $entry - 1;
echo '<a href="index.php?entry=1">first</a> ';
echo '<a href="index.php?entry='. $prev .'">&lt; prev</a> ';
}
+ // Next / last links.
if ($entry < $entries) {
$next = $entry + 1;
echo '<a href="index.php?entry='. $next .'">next &gt;</a> ';