Date search problem
Hello!
I am having an issue with a DataAssist search that searches by year within a date field ("DatePublished"). If any year prior to 2000 is input into the search, everything works fine. However, if any year from 2000 forward is input, the results return records from the input year PLUS all records from 2008 (in every case). Does anyone have any idea what would be causing this? I've pasted the search code below. Thanks in advance for you help.
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsPresentations;
//Searchpage: presentation_results.php;
//Form: PresentationSearch;
$Presentation_Search_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["Presentation_Search"])) && ($_POST["Presentation_Search"] != "")) {
$Presentation_Search = new FilterDef;
$Presentation_Search->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
if ($_POST["searchBy"] == keyword) {
$KeyArr1 = array("Library.Title", "Library.Description", "DatePublished", "Keywords", "LibEventLibraryID_Lib_EventTopic", "LibEventLibraryID_Lib_EventTopic2", "LibEventLibraryID_Lib_EventTopic3", "LibEventLibraryID_Lib_EventTopic4", "LibEventLibraryID_Lib_EventTopic5", "LibEventLibraryID_Lib_EventTopic6", "LibEventLibraryID_Lib_EventTopic7","SSCate", "AgendaPresenterAgendaItemID_AgPrst_PresenterNameFirst", "AgendaPresenterAgendaItemID_AgPrst_PresenterNameLast");
}
elseif ($_POST["searchBy"] == title) {
$KeyArr1 = array("Title");
}
elseif ($_POST["searchBy"] == year) {
$KeyArr1 = array("DatePublished");
}
elseif ($_POST["searchBy"] == speaker) {
$KeyArr1 = array("AgendaPresenterAgendaItemID_AgPrst_PresenterNameFirst", "AgendaPresenterAgendaItemID_AgPrst_PresenterNameLast");
}
//comparison list additions
$Presentation_Search->keywordComparison($KeyArr1,"".((isset($_POST["searchField"]))?$_POST["searchField"]:"") ."","AND","Includes","%20","|","%22","%22",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["Presentation_Search_index"]=$Presentation_Search->whereClause;
}
}
else {
$Presentation_Search = new FilterDef;
$Presentation_Search->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["Presentation_Search_index"]) && $_SESSION["Presentation_Search_index"] != "") {
$Presentation_Search->whereClause = $_SESSION["Presentation_Search_index"];
}
else {
$Presentation_Search->whereClause = $Presentation_Search_DefaultWhere;
}
}
else {
$Presentation_Search->whereClause = $Presentation_Search_DefaultWhere;
}
}
$Presentation_Search->whereClause = str_replace("\\''", "''", $Presentation_Search->whereClause);
$Presentation->SearchwhereClause = '';
?>