close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problems with my search

Thread began 12/17/2012 12:46 am by Noa2086 | Last modified 12/18/2012 11:33 am by Jason Byrnes | 1113 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!

Sign in to reply to this post

Jason ByrnesWebAssist

send a link where i can see the problem please.

and a copy of the search and results pages in a zip archive so i can see the code.

Sign in to reply to this post

Noa2086

it's a kind of secret project (yet).
in my recordset "Fuhrpark" (cars) i have a column named "Kanton" (state).
i don't have checkboxes, i use a url generator on the search page (jquery etc).

i need the correct url and search behavior.

normally the url is

results.php?parameter1=value&checkbox[]=value2&checkbox[]=value3&checkbox[]=value4&parameter2=value5



for checkbox search? i would like to display every match with value, value2, value3, value4 and value5. in my example checkbox[] will be "Kanton" (state). i need the results of value and value5 (parameter1 and parameter2) in value2 or value3 or value4 (checkboxes).

and the search behavior:

$WADbSearch1->addComparisonFromEdit("column_parameter1","url_parameter1","AND","=",1);
$WADbSearch1->addComparisonFromEdit("column_checkbox","url_checkbox","OR","=",0);
$WADbSearch1->addComparisonFromEdit("column_parameter2","url_parameter2","AND","=",0);



thx for your time.

Attached Files
results.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

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