close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Problems with my search

Thread began 12/17/2012 12:46 am by Noa2086 | Last modified 12/18/2012 11:33 am by Noa2086 | 1131 views | 3 replies

Noa2086

Problems with my search

hi jason!

i would like to search in my database with multiple options. in this case "state". i have database entries with one state value (for example state = bern). in the search i can select multiple states. it does not work fine. all other options are ignored.

my search code:

<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: Fuhrpark_2;
//Searchpage: index.php;
//Form: Suchen_Limofinder_XSmall;
$WADbSearch2_DefaultWhere = "0=1";
if (!session_id()) session_start();
if (isset($_GET['Suchen']) && $_GET['Suchen'] == "AltFinden") {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//keyword array declarations

//comparison list additions
$WADbSearch2->addComparisonFromEdit("Fahrzeugart","Fahrzeugart","AND","=",1);
$WADbSearch2->addComparisonFromEdit("Fahrzeugbezeichnung","Fahrzeugbezeichnung","AND","Includes",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton","AND","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_2","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_3","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_4","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_5","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_6","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_7","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_8","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_9","OR","=",0);
$WADbSearch2->addComparisonFromEdit("Kanton","AltKanton_10","AND","=",0);
$WADbSearch2->addComparisonFromEdit("Sitze","Sitze","AND",">=",1);
$WADbSearch2->addComparisonFromEdit("Farbe","Farbe","AND","=",0);
$WADbSearch2->addComparisonFromEdit("PreisWeitere","PreisWeitere","AND","<=",1);

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



AltKanton = State.

my url:

fahrzeuge.php?Fahrzeugart=1&Fahrzeugbezeichnung=&Kanton=Waadt&AltKanton=Freiburg&AltKanton_2=Genf&AltKanton_3=Neuenburg&AltKanton_4=Wallis&Sitze=&Farbe=Pink&PreisWeitere=500&Suchen=AltFinden



i can't find the error. i want to pass all AltKanton values through the search. the other values must match.

thx for your help!

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...