Multiple errors as a result of Search Wizard code.
I've tried several times to build this search. I'm cleared out the cache ... removed and reinstalled the extension. Still getting this problem. I'm now too frustrated to go any further.
--------------------------------------------------
The error(s):
Notice: Undefined variable: rsOrders in /home/sandyrumsey/public_html/ssl/_admin_pfg_10/orders_Srch/index.php on line 102
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/sandyrumsey/public_html/ssl/_admin_pfg_10/orders_Srch/index.php on line 102
Notice: Undefined variable: WADbSearch1 in /home/sandyrumsey/public_html/ssl/_admin_pfg_10/orders_Srch/index.php on line 103
Notice: Trying to get property of non-object in /home/sandyrumsey/public_html/WADbSearch/HelperPHP.php on line 381
Notice: Trying to get property of non-object in /home/sandyrumsey/public_html/WADbSearch/HelperPHP.php on line 395
--------------------------------------------------------------------------------------
My page sql code:
<?php require_once('../../../Connections/traders.php'); ?>
<?php require_once( "../../../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
//WA Database Search Include
require_once("../../../WADbSearch/HelperPHP.php");
?>
<?php
if (!WA_Auth_RulePasses("Logged in to users")){
WA_Auth_RestrictAccess("../users_EmailPW.php");
}
?>
<?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;
}
}
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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_traders, $traders);
$query_coupon = "SELECT * FROM coupons ORDER BY couponNum ASC";
$coupon = mysql_query($query_coupon, $traders) or die(mysql_error());
$row_coupon = mysql_fetch_assoc($coupon);
$totalRows_coupon = mysql_num_rows($coupon);
mysql_select_db($database_traders, $traders);
$query_affiliate = "SELECT * FROM affiliates ORDER BY AffiliateLink ASC";
$affiliate = mysql_query($query_affiliate, $traders) or die(mysql_error());
$row_affiliate = mysql_fetch_assoc($affiliate);
$totalRows_affiliate = mysql_num_rows($affiliate);
$maxRows_rsOrders = 45;
$pageNum_rsOrders = 0;
if (isset($_GET['pageNum_rsOrders'])) {
$pageNum_rsOrders = $_GET['pageNum_rsOrders'];
}
$startRow_rsOrders = $pageNum_rsOrders * $maxRows_rsOrders;
mysql_select_db($database_traders, $traders);
$query_rsOrders = "SELECT * FROM customers, orders, orderdetail WHERE customers.custID = orders.CustomerID AND orderdetail.orderID = orders.OrderId ORDER BY orders.OrderId DESC";
setQueryBuilderSource($query_rsOrders,$WADbSearch1,false);
$query_limit_rsOrders = sprintf("%s LIMIT %d, %d", $query_rsOrders, $startRow_rsOrders, $maxRows_rsOrders);
$rsOrders = mysql_query($query_limit_rsOrders, $traders) or die(mysql_error());
$row_rsOrders = mysql_fetch_assoc($rsOrders);
if (isset($_GET['totalRows_rsOrders'])) {
$totalRows_rsOrders = $_GET['totalRows_rsOrders'];
} else {
$all_rsOrders = mysql_query($query_rsOrders);
$totalRows_rsOrders = mysql_num_rows($all_rsOrders);
}
$totalPages_rsOrders = ceil($totalRows_rsOrders/$maxRows_rsOrders)-1;
$colname_rsaffiliateSession = "-1";
if (isset($_SESSION['affiliate'])) {
$colname_rsaffiliateSession = (get_magic_quotes_gpc()) ? $_SESSION['affiliate'] : addslashes($_SESSION['affiliate']);
}
mysql_select_db($database_traders, $traders);
$query_rsaffiliateSession = sprintf("SELECT * FROM affiliates WHERE AffiliateID = %s", GetSQLValueString($colname_rsaffiliateSession, "int"));
$rsaffiliateSession = mysql_query($query_rsaffiliateSession, $traders) or die(mysql_error());
$row_rsaffiliateSession = mysql_fetch_assoc($rsaffiliateSession);
$totalRows_rsaffiliateSession = mysql_num_rows($rsaffiliateSession);
$queryString_rsOrders = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsOrders") == false &&
stristr($param, "totalRows_rsOrders") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsOrders = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsOrders = sprintf("&totalRows_rsOrders=%d%s", $totalRows_rsOrders, $queryString_rsOrders);
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsOrders;
//Searchpage: index.php;
//Form: srchForm;
$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("Date","startDate","AND",">=",2);
$WADbSearch1->addComparison("Date","".WAQB_getEndDate($_POST["endDate"]) ."","AND","<=",2);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_index"]=$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_index"]) && $_SESSION["WADbSearch1_index"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_index"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>