Thank you. I tried that but it didn't seem to work so I have included the code below. I just changed two '=' signs as you can see. Any guidance would be very welcome.
Also, this example only checks if the surname field matches the surname input field. Because some names are put the other way round I wanted to check the forename field against the surname input as well. Is that possible?
The code is:
<?php
//WA Database Search Include
require_once("../../WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsList;
//Searchpage: conflict_check.php;
//Form: form1;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
//comparison list additions
$WADbSearch1->addComparisonFromEdit("surname","surname","AND","includes",0);
$WADbSearch1->addComparisonFromEdit("postcode","postcode","OR","includes",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_conflict_check_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_conflict_check_results"]) && $_SESSION["WADbSearch1_conflict_check_results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_conflict_check_results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
// Load the tNG classes
require_once('../../includes/tng/tNG.inc.php');
// Make unified connection variable
$conn_blac = new KT_connection($blac, $database_blac);
//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_blac, "../../");
//Grand Levels: Level
$restrict->addLevel("9");
$restrict->Execute();
//End Restrict Access To Page
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;
}
}
mysql_select_db($database_blac, $blac);
$query_rsList = "SELECT clientid, forename, surname, add1, add2, add3, town, postcode FROM client ORDER BY surname ASC";
setQueryBuilderSource($query_rsList,$WADbSearch1,false);
$rsList = mysql_query($query_rsList, $blac) or die(mysql_error());
$row_rsList = mysql_fetch_assoc($rsList);
$totalRows_rsList = mysql_num_rows($rsList);
?>
<table border="1">
<tr>
<td>clientid</td>
<td>forename</td>
<td>surname</td>
<td>add1</td>
<td>add2</td>
<td>add3</td>
<td>town</td>
<td>postcode</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_rsList['clientid']; ?></td>
<td><?php echo $row_rsList['forename']; ?></td>
<td><?php echo $row_rsList['surname']; ?></td>
<td><?php echo $row_rsList['add1']; ?></td>
<td><?php echo $row_rsList['add2']; ?></td>
<td><?php echo $row_rsList['add3']; ?></td>
<td><?php echo $row_rsList['town']; ?></td>
<td><?php echo $row_rsList['postcode']; ?></td>
</tr>
<?php } while ($row_rsList = mysql_fetch_assoc($rsList)); ?>
</table>