View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

date range search not working

Thread began 9/04/2009 6:56 am by colin282897 | Last modified 9/08/2009 12:04 pm by colin282897 | 948 views | 1 replies

colin282897

date range search not working

I have used the WA search wizard to create a very simple search page that searches the database for a username then a date range but it doesn't seam to be working. The username part works fine but the date range does not. The date in the database is in the format dd.mm.yy

form code=

<form name="renew" action="renew_list.php" method="post">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="right"><label for="username">Keywords</label></td>
<td><input type="text" name="username" value="" /></td>
</tr>
<tr>
<td align="right"><label for="startdate">Date Range</label></td>
<td><input type="text" name="startdate" value="" />
&nbsp;
<label for="enddate">To:</label>
&nbsp;
<input type="text" name="enddate" value="" />
&nbsp;(dd.mm.yy)</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="WADbSearch1" value="Submit" /></td>
</tr>
</table>

search code on results page=

<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: renew_list;
//Searchpage: renew_search.php;
//Form: renew;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("user_name");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_POST["username"]))?$_POST["username"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->addComparisonFromEdit("date","startdate","AND",">=",2);
$WADbSearch1->addComparisonFromEdit("date","enddate","AND","<=",2);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_renew_list"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_renew_list"]) && $_SESSION["WADbSearch1_renew_list"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_renew_list"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>

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...