close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two search fields, KEY won't work without second filled.

Thread began 3/05/2017 7:16 pm by bjgarner241692 | Last modified 3/06/2017 6:03 pm by Ray Borduin | 151 views | 2 replies |

bjgarner241692

Two search fields, KEY won't work without second filled.

php:
<?php

//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: results;
//Searchpage: search.php;
//Form: form2;
$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("HomeName""Address""City""Province""PostalCode""Website""OwnerManager");

  
//comparison list additions
  
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_POST["name"]))?$_POST["name"]:"")  ."","AND","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->addComparisonFromList("Province","prov","OR","=",0);

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



I want to be able to search on Keyword OR Prov. The Keyword field compares to multiple database columns. The Prov field compares to only one.
Prov works fine, but Keyword only works if I make a selection in Prov.

I have tried AND and OR for both search variables and cannot resolve the issue.

Is what I am doing possible?

Sign in to reply to this post

Ray BorduinWebAssist

Update the first option in your province list from:
<option selected="selected">All</option>

to:
<option value="" selected="selected">All</option>

You have to pass a blank value in order to have it ignored.

Sign in to reply to this post

bjgarner241692

Thank you!
Too simple. Can't believe I missed that.

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