Hi Jason, hope you're well.
I still have the problem with the search on the distributors page returning results that shouldn't be returned. I've now added a jQuery autocomplete to the search box, so when you type you get a prompt of the matching database content. If I click on one of the autocomplete results, very specific content appears in the search box, content that only matches one record, however when that is submitted, I am still getting multiple, unrelated results appear in my search results.
Why is this?
I am currently out of the office a lot as I am contracting in-house for another company, so I am not able to do Skype very easily… sorry about this!
Presumptuous of me I know, but if you can't log on to my server using the previously provided details, here's my search code:
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr0 = array("fld_dNAME", "fld_dCOUNTRY", "fld_dAREA", "fld_dADDRESS");
//comparison list additions
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_POST["distsearch"]))?$_POST["distsearch"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_disttest"]=$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_disttest"]) && $_SESSION["WADbSearch1_disttest"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_disttest"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
and here's my search box code:
<form name="distform" action="distributors.php" method="post">
<input name="distsearch" type="text" class="distsearchbox" id="distsearch" placeholder="Start to type here to locate distributors..." value="">
<input name="WADbSearch1" type="submit" class="distsearchbtn" value="Go" style="padding:7px 20px">
</form>
I'm assuming that I have my search set to match any individual word in the search box rather than the complete phrase entered.