Binding DataAssist field; error
I have created a search page using the wizard (public view). I have created a recordset, and all of my database fields are recognized. You can see a copy of my test behavior in the two files below. Is there any other binding that I should be doing?
In Live View, i receive the following error message "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 0=0' at line 1"
The Where statement is actually on line 11. Here is some of the code:
<?php require_once('Connections/localhost.php'); ?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: Recordset1;
//Searchpage: ;
//Form: ;
$WADbSearch4_DefaultWhere = "WHERE 0=0";
if (!session_id()) session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WADbSearch4 = new FilterDef;
$WADbSearch4->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
//comparison list additions
$WADbSearch4->addComparison("Role","".((isset($_GET["S_Role"]))?$_GET["S_Role"]:"") ."","AND","=",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch4_users_Search"]=$WADbSearch4->whereClause;
}
}
else {
$WADbSearch4 = new FilterDef;
$WADbSearch4->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch4_users_Search"]) && $_SESSION["WADbSearch4_users_Search"] != "") {
$WADbSearch4->whereClause = $_SESSION["WADbSearch4_users_Search"];
}
else {
$WADbSearch4->whereClause = $WADbSearch4_DefaultWhere;
}
}
else {
$WADbSearch4->whereClause = $WADbSearch4_DefaultWhere;
}
}
$WADbSearch4->whereClause = str_replace("\\''", "''", $WADbSearch4->whereClause);
$WADbSearch4whereClause = '';
?>
<?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);
I would appreciate any help. Thank you.