close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date search problem

Thread began 7/14/2009 5:05 pm by michellem310468 | Last modified 7/15/2009 7:47 am by Ray Borduin | 1738 views | 1 replies |

michellem310468

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 = '';
?>

Sign in to reply to this post

Ray BorduinWebAssist

Add debug code below this code:

<?php die($Presentation_Search->whereClause); ?>

What is the where clause it is using?

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...