close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Multiple Select List

Thread began 9/25/2010 7:23 am by Cologne | Last modified 9/27/2010 11:55 am by Cologne | 1830 views | 18 replies

Dave BuchholzBeta Tester

Sorry for the delay in replying I had to leave the office for a few hours.

Yes you would use linking tables for this to work efficiently, you would use a join in your recordset that the search uses to achieve this.

Here are examples of a data assist search and the corresponding recordset

php:
<?php

//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsMainView;
//Searchpage: search-form.php;
//Form: frmSearch;
$WADbSearch1_DefaultWhere "";
if (!
session_id()) session_start();
if ((isset(
$_GET["WADbSearch1"])) && ($_GET["WADbSearch1"] != "")) {
  
$WADbSearch1 = new FilterDef;
  
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
  
//keyword array declarations
  
$KeyArr0 = array("tbl_products.title");
  
$KeyArr1 = array("tbl_products.sku");
  
$KeyArr2 = array("tbl_products.details");
  
$KeyArr3 = array("fk.title");
  
$KeyArr4 = array("pt.title");  
  
$KeyArr5 = array("tbl_products.title");
  
$KeyArr6 = array("tbl_products.details");
  
$KeyArr7 = array("tbl_products.sku");

  
//comparison list additions
  
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_GET["zoom_query"]))?$_GET["zoom_query"]:"")  ."","OR","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_GET["zoom_query"]))?$_GET["zoom_query"]:"")  ."","OR","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr2,"".((isset($_GET["zoom_query"]))?$_GET["zoom_query"]:"")  ."","OR","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr3,"".((isset($_GET["zoom_query"]))?$_GET["zoom_query"]:"")  ."","OR","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr4,"".((isset($_GET["zoom_query"]))?$_GET["zoom_query"]:"")  ."","OR","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr5,"".((isset($_GET["S_title"]))?$_GET["S_title"]:"")  ."","AND","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr6,"".((isset($_GET["S_details"]))?$_GET["S_details"]:"")  ."","AND","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->keywordComparison($KeyArr7,"".((isset($_GET["S_sku"]))?$_GET["S_sku"]:"")  ."","AND","Includes",",%20","%20","%22","%22",0);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.sortorder","S_sortorder","AND","=",1);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.publish","S_publish","AND","=",1);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.dateinsert","S_dateinsert","AND","=",2);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.dateupdate","S_dateupdate","AND","=",2);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.categories","S_fk","AND","=",1);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.subcategories","S_subcat","AND","=",1);
  
$WADbSearch1->addComparisonFromEdit("tbl_products.prodtypes","S_prodtype","AND","=",1);

  
//save the query in a session variable
  
if ((isset($_GET["WADbSearch1"])) && ($_GET["WADbSearch1"] != "")) {
    
$_SESSION["WADbSearch1_products"]=$WADbSearch1->whereClause;
  }
}
else     {
  
$WADbSearch1 = new FilterDef;
  
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
  
//get the filter definition from a session variable
  
if ((isset($_GET["WADbSearch1"])) && ($_GET["WADbSearch1"] != ""))     {
    if (isset(
$_SESSION["WADbSearch1_products"]) && $_SESSION["WADbSearch1_products"] != "")     {
      
$WADbSearch1->whereClause $_SESSION["WADbSearch1_products"];
    }
    else     {
      
$WADbSearch1->whereClause $WADbSearch1_DefaultWhere;
    }
  }
  else     {
    
$WADbSearch1->whereClause $WADbSearch1_DefaultWhere;
  }
}
$WADbSearch1->whereClause str_replace("\\''""''"$WADbSearch1->whereClause);
$WADbSearch1whereClause '';
?>

mysql_select_db($database_connDB, $connDB);
$query_rsMainView = "SELECT tbl_products.*, fk.title AS fkTitle, pt.title AS ptTitle FROM tbl_products JOIN tbl_lnkproductcategories ON (tbl_products.id = tbl_lnkproductcategories.products) JOIN tbl_categories AS fk ON (tbl_lnkproductcategories.categories = fk.id) JOIN tbl_lnkproductprodtypes ON (tbl_products.id = tbl_lnkproductprodtypes.products) JOIN tbl_prodtypes AS pt ON (tbl_lnkproductprodtypes.prodtypes = pt.id) GROUP BY tbl_products.id ORDER BY tbl_products.sortorder DESC, tbl_products.sku, tbl_products.title";
setQueryBuilderSource($query_rsMainView,$WADbSearch1,false);
$query_limit_rsMainView = sprintf("%s LIMIT %d, %d", $query_rsMainView, $startRow_rsMainView, $maxRows_rsMainView);
$rsMainView = mysql_query($query_limit_rsMainView, $connDB) or die(mysql_error());
$row_rsMainView = mysql_fetch_assoc($rsMainView);

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...