Need a hand getting started with Search page
I've been trying to follow the tutorial but am finding it hard to adapt to my own site.
I would like to create a search page to return results from a links directory database. What I want is so that visitors can enter a search term, eg. photographer, it will return only those records that are related to photography. I have tried using a Db field called Keywords and set the search wizard to target that but it just displays all records in the Db.
My code is:
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsItems;
//Searchpage: search.php;
//Form: frmSearchForm;
$WADbSearch1_DefaultWhere = "WHERE 0 <> 0";
if (!session_id()) session_start();
if (isset($_POST["button2"])) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("Keywords");
//comparison list additions
$WADbSearch1->keywordComparison($KeyArr1,"".$row_rsItems['Keywords'] ."","OR","Includes","%20AND%20","%20OR%20","%22","%22",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_search_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_search_results"]) && $_SESSION["WADbSearch1_search_results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_search_results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>