2 where clauses in data assist search
hi,
i have tried adding in the wizard 2 where clauses as you will see from my code however it does not work. it is executing the first where clause but the second it is not. it shows the archived properties even though i want it to only show the non archived properties (= 0) (archive = 1)
here is the the php code:
<?php require_once('Connections/cbank.php'); ?>
<?php
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make unified connection variable
$conn_cbank = new KT_connection($cbank, $database_cbank);
//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_cbank, "");
//Grand Levels: Level
$restrict->addLevel("1");
$restrict->Execute();
//End Restrict Access To Page
?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: WADAproperties;
//Searchpage: properties_Results.php;
//Form: WADASearchForm;
$WADbSearch1_DefaultWhere = "ProductTypeID <= 14 and Archive = 0";
if (!session_id()) session_start();
if ((isset($_GET["WADbSearch1"])) && ($_GET["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("PropertyRef");
$KeyArr2 = array("SaleType");
$KeyArr3 = array("Country");
$KeyArr4 = array("Development");
$KeyArr5 = array("PropertyCompany");
//comparison list additions
$WADbSearch1->addComparisonFromEdit("PriceofProperty","S_PriceofProperty","AND","=",1);
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_GET["S_PropertyRef"]))?$_GET["S_PropertyRef"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->keywordComparison($KeyArr2,"".((isset($_GET["S_SaleType"]))?$_GET["S_SaleType"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->addComparisonFromEdit("ProductTypeID","S_ProductTypeID","OR","=",1);
$WADbSearch1->keywordComparison($KeyArr3,"".((isset($_GET["S_Country"]))?$_GET["S_Country"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->keywordComparison($KeyArr4,"".((isset($_GET["S_Development"]))?$_GET["S_Development"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->keywordComparison($KeyArr5,"".((isset($_GET["S_PropertyCompany"]))?$_GET["S_PropertyCompany"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_properties_Results"]=$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_properties_Results"]) && $_SESSION["WADbSearch1_properties_Results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_properties_Results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php
$maxRows_WADAproperties = 10;
$pageNum_WADAproperties = 0;
if (isset($_GET['pageNum_WADAproperties'])) {
$pageNum_WADAproperties = $_GET['pageNum_WADAproperties'];
}
$startRow_WADAproperties = $pageNum_WADAproperties * $maxRows_WADAproperties;
mysql_select_db($database_cbank, $cbank);
$query_WADAproperties = "SELECT PropertyID, ProductTypeID, clients_ClientID, PropertyRef, SaleType, Country, PropertyCompany, Development, PropertyType, UnitNo, PriceofProperty, ProductName, ProductDescription, Scurrency, DepositPercentage, Special, SpecialPrice, DateSpecialEnds, GMAPCommission, APCommission, PCCommission, AgentCommission, SubAgentCommission, IFAFee, SippFee, Image1, Image1path, Image2, Image2Path, Archive FROM properties ORDER BY PriceofProperty ASC";
setQueryBuilderSource($query_WADAproperties,$WADbSearch1,false);
$query_limit_WADAproperties = sprintf("%s LIMIT %d, %d", $query_WADAproperties, $startRow_WADAproperties, $maxRows_WADAproperties);
$WADAproperties = mysql_query($query_limit_WADAproperties, $cbank) or die(mysql_error());
$row_WADAproperties = mysql_fetch_assoc($WADAproperties);
if (isset($_GET['totalRows_WADAproperties'])) {
$totalRows_WADAproperties = $_GET['totalRows_WADAproperties'];
} else {
$all_WADAproperties = mysql_query($query_WADAproperties);
$totalRows_WADAproperties = mysql_num_rows($all_WADAproperties);
}
$totalPages_WADAproperties = ceil($totalRows_WADAproperties/$maxRows_WADAproperties)-1;
?>
<?php
$maxRows_WADADynListproduct_provider = 1000;
$pageNum_WADADynListproduct_provider = 0;
if (isset($_GET['pageNum_WADADynListproduct_provider'])) {
$pageNum_WADADynListproduct_provider = $_GET['pageNum_WADADynListproduct_provider'];
}
$startRow_WADADynListproduct_provider = $pageNum_WADADynListproduct_provider * $maxRows_WADADynListproduct_provider;
mysql_select_db($database_cbank, $cbank);
$query_WADADynListproduct_provider = "SELECT ProductProvider, ProductProvider FROM product_provider ORDER BY ProductProvider";
$query_limit_WADADynListproduct_provider = sprintf("%s LIMIT %d, %d", $query_WADADynListproduct_provider, $startRow_WADADynListproduct_provider, $maxRows_WADADynListproduct_provider);
$WADADynListproduct_provider = mysql_query($query_limit_WADADynListproduct_provider, $cbank) or die(mysql_error());
$row_WADADynListproduct_provider = mysql_fetch_assoc($WADADynListproduct_provider);
if (isset($_GET['totalRows_WADADynListproduct_provider'])) {
$totalRows_WADADynListproduct_provider = $_GET['totalRows_WADADynListproduct_provider'];
} else {
$all_WADADynListproduct_provider = mysql_query($query_WADADynListproduct_provider);
$totalRows_WADADynListproduct_provider = mysql_num_rows($all_WADADynListproduct_provider);
}
$totalPages_WADADynListproduct_provider = ceil($totalRows_WADADynListproduct_provider/$maxRows_WADADynListproduct_provider)-1;
?>
<?php
$queryString_WADAproperties = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_WADAproperties") == false &&
stristr($param, "totalRows_WADAproperties") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_WADAproperties = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_WADAproperties = sprintf("&totalRows_WADAproperties=%d%s", $totalRows_WADAproperties, $queryString_WADAproperties);
// Show Dynamic Thumbnail
$objDynamicThumb1 = new tNG_DynamicThumbnail("", "KT_thumbnail1");
$objDynamicThumb1->setFolder("PropImages/");
$objDynamicThumb1->setRenameRule("{WADAproperties.Image1}");
$objDynamicThumb1->setResize(250, 150, false);
$objDynamicThumb1->setWatermark(false);
$objDynamicThumb1->setPopupSize(800, 600, false);
$objDynamicThumb1->setPopupNavigation(true);
$objDynamicThumb1->setPopupWatermark(false);
// Show Dynamic Thumbnail
$objDynamicThumb1 = new tNG_DynamicThumbnail("", "KT_thumbnail1");
$objDynamicThumb1->setFolder("PropImages/");
$objDynamicThumb1->setRenameRule("{WADAproperties.Image1path}");
$objDynamicThumb1->setResize(250, 250, false);
$objDynamicThumb1->setWatermark(false);
$objDynamicThumb1->setPopupSize(800, 600, false);
$objDynamicThumb1->setPopupNavigation(false);
$objDynamicThumb1->setPopupWatermark(false);
?>
is there a way to have 2 where clauses using data assist?
thanks