summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2014-02-18 21:55:22 +0000
committerNathan Kinkade <nath@nkinka.de>2014-02-18 21:55:22 +0000
commit551c7579b5d818abd5c7452bae1a5077e5fae3d6 (patch)
tree0d77f847c4e732c394df0d9d12540ad3d3cd3210
parent2fd5e6712f79afb7556ae628a7a45e7114f51f2f (diff)
Added a special 'between' search that I'll use internally. And also fixed a problem where a MySQL date field can't be compared to an empty string.
-rw-r--r--search.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/search.php b/search.php
index d6ab5ed..cbbd290 100644
--- a/search.php
+++ b/search.php
@@ -44,6 +44,7 @@ $database_fields = array(
// Get all the request parameters into local variables for readability
$request_params = array(
'case_id' => '',
+ 'between' => '',
'case_years' => '',
'case_num' => '',
'defendant' => '',
@@ -91,6 +92,11 @@ if ( $case_id ) {
$where_parts_and[] = "id = '$case_id'";
}
+if ( $between ) {
+ list($btwn_start, $btwn_end) = explode(':', $between);
+ $where_parts_and[] = "court_case_no BETWEEN '$btwn_start' AND '$btwn_end'";
+}
+
if ( $case_years && $case_num && $defendant ) {
foreach ( $case_years as $case_year ) {
$case_year = substr($case_year, -2);
@@ -170,9 +176,9 @@ if ( $disposition ) {
if ( $case_closed ) {
if ( $case_closed == 'yes' ) {
- $where_parts_and[] = " cases.date_closed IS NOT NULL OR cases.date_closed != '' ";
+ $where_parts_and[] = "cases.date_closed IS NOT NULL";
} elseif ( $case_closed == 'no' ) {
- $where_parts_and[] = " cases.date_closed IS NULL OR cases.date_closed = '' ";
+ $where_parts_and[] = "cases.date_closed IS NULL";
}
}