From 2ec3b3c05e535ffacb1e10a64aa62ad057499d47 Mon Sep 17 00:00:00 2001 From: Silvio Date: Mon, 16 Aug 2010 15:37:31 -0300 Subject: Adding helper classes and repetition finder --- tests/repetition.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/repetition.php (limited to 'tests/repetition.php') diff --git a/tests/repetition.php b/tests/repetition.php new file mode 100644 index 0000000..7555016 --- /dev/null +++ b/tests/repetition.php @@ -0,0 +1,45 @@ +form($display->form_input_text('code'), 'repetition.php'); + +// Get field code. +$code = CinisisHttpHelper::get_numeric_arg('code'); + +// Get a db instance. +$isis = new CinisisDb(); + +// Setup database and entry number. +if ($isis->db) { + // Get the number of entries. + $field = $isis->db->format['fields'][$code]['name']; + $entries = $isis->db->entries(); + $entry = 1; + + // Query database. + do { + $result = $isis->db->read($entry++); + if ($entry == $entries) { + break; + } + } while (!isset($result[$field]) || count($result[$field]) < 2); + + // Format output. + echo "
\n";
+  echo "Showing entry $entry from $entries total entries.\n";
+  echo "Selected field: $field.\n";
+  echo "Repetitions found: ". count($result[$field]) ."\n";
+  echo "\n";
+  print_r($result);
+  echo '
'; +} + +$display->footer(); +?> -- cgit v1.2.3