have a database search using dreamweaver 8 master results built page with Web Assist database search and i have been told that if i don't want all records to show when the results page is accessed directly then i should use the WHERE CLAUSE "WHERE 0<>0"
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rs_item;
//Searchpage: ;
//Form: ;
$WADbSearch1_DefaultWhere = "WHERE 0<>0";
if (!session_id()) session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
//comparison list additions
$WADbSearch1->addComparisonFromCheck("item_number","search1","".((isset($_POST["search1"]))?$_POST["search1"]:"") ."","0","AND","Includes","=",0);
$WADbSearch1->addComparisonFromCheck("item_description","search1","".((isset($_POST["search1"]))?$_POST["search1"]:"") ."","0","OR","Includes","=",0);
$WADbSearch1->addComparisonFromCheck("category","search1","".((isset($_POST["search1"]))?$_POST["search1"]:"") ."","0","OR","Includes","=",0);
$WADbSearch1->addComparisonFromCheck("vendor_name","search1","".((isset($_POST["search1"]))?$_POST["search1"]:"") ."","0","OR","Includes","=",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_item_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_item_results"]) && $_SESSION["WADbSearch1_item_results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_item_results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
the "WHERE 0<>0" produces this error -
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 LIMIT 0, 25' at line 1
if i remove the "WHERE 0<>0" and have just ""
then all records show when the page loads. (I have the search text field on the same page as the results.)
any suggestions?
thanks for your help
JBWebWorks