close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Why my County OR fields only work if one is selected?

Thread began 4/16/2013 11:02 am by kphillips162496 | Last modified 4/17/2013 9:55 am by kphillips162496 | 660 views | 3 replies |

kphillips162496

Why my County OR fields only work if one is selected?

I setup a search, that everything works except the County, when more than 1 is selected. If you select no county (checkbox) or just one of the counties (checkbox) it works great, but if you select 2 or more of the 3 checkbox's, then the results are wrong.
Here is what I have for the coding.
$WADbSearch2_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_GET["WADbSearch2"])) && ($_GET["WADbSearch2"] != "")) {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//keyword array declarations

//comparison list additions
$WADbSearch2->addComparisonFromList("County","countyname","OR","=",0);
$WADbSearch2->addComparisonFromList("County","countyname2","OR","=",0);
$WADbSearch2->addComparisonFromList("County","countyname3","OR","=",0);
$WADbSearch2->addComparisonFromList("BodyOfWater","LakeAnna","AND","=",0);
$WADbSearch2->addComparisonFromList("WaterFront","waterOrientation_WF","AND","=",0);
$WADbSearch2->addComparisonFromList("WaterAccess","waterOrientation_WA","AND","=",0);
$WADbSearch2->addComparisonFromList("WaterView","waterOrientation_VW","AND","=",0);
$WADbSearch2->addComparisonFromEdit("ListPrice","minPrice","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("ListPrice","maxPrice","AND","<=",1);
$WADbSearch2->addComparisonFromEdit("Bedrooms","minBeds","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("Bedrooms","maxBeds","AND","<=",1);
$WADbSearch2->addComparisonFromEdit("BathsFull","minBath","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("BathsFull","maxBath","AND","<=",1);
$WADbSearch2->addComparisonFromCheck("Docks","dock","1","","AND",">=","<>",1);
$WADbSearch2->addComparisonFromCheck("BasementY_N","basement","True","","AND","=","=",0);
$WADbSearch2->addComparisonFromEdit("TotalSquareFootage","minSQFT","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("TotalSquareFootage","maxSQFT","AND","<=",1);
$WADbSearch2->addComparisonFromEdit("Garage_Spaces","garage_min","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("Garage_Spaces","garage_max","AND","<=",1);
$WADbSearch2->addComparisonFromEdit("Levels","levels_min","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("Levels","levels_max","AND","<=",1);

What am I missing?

Sign in to reply to this post

Jason ByrnesWebAssist

Data assist search does not grouping in the way yo are expecting.

instead of using multiple form elements for the country, use only one multiple select list to list the countries, in data assist search, set the country criteria to a keyword type.

for the Keyword OR separator, use a comma followed by a space:
", "

for the and separator, enter:
"and "

set the name of the multiple select list to end in "[]" this will pass an array of the selections. and add the following code at line 1 to convert the array to a comma seperated list:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

kphillips162496

Worked Beautifully

Thank you very much, that did the trick!

Sign in to reply to this post

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