K, I'll still take responses to this , but things
seemed to have improved once I stopped using same
variable for both boxes ....ooops!

Stuart
--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

> I am in the process of building a search form for
> the
> database.  The entire thing consists of 3 multi
> selects and 2 text boxes with a "contains".  Oh and
> I've only rigged 2 of the multi selects for the time
> being.
> So the way the multiselects should work that the
> user
> can  choose one or the other or both, but the more
> criteria provided back to the query , the more
> refined
> the return. 
> 
> Here is the code and my tale of woe
> follows:($projects
> is a just a holder / variable)
> 
> function BindEvents()
> {
>     global $VendorJobs;
>    
> $VendorJobs->ds->CCSEvents["BeforeExecuteSelect"]
> = "VendorJobs_ds_BeforeExecuteSelect";
> }
> //End BindEvents Method
> 
> //VendorJobs_ds_BeforeExecuteSelect @2-A4F75E44
> function VendorJobs_ds_BeforeExecuteSelect()
> {
>     $VendorJobs_ds_BeforeExecuteSelect = true;
> //End VendorJobs_ds_BeforeExecuteSelect
> 
> global $VendorJobs;
> $s_Industry = CCGetParam("s_Industry", "");
> if (count($s_Industry) > 0 AND
> is_array($s_Industry))
> {
> foreach ($s_Industry as $key => $value) {
> if ($Projects != "") $Projects = $Projects.",";
> $Projects = $Projects."'".$value."'";
> }
> }
> if ($Projects)
> $VendorJobs->ds->SQL.= " AND (`VendorJobs`.Industry
> IN
> (".$Projects."))";
> 
> $s_LocationState = CCGetParam("s_LocationState",
> "");
> if (count($s_LocationState) > 0 AND
> is_array($s_LocationState)) {
> foreach ($s_LocationState as $key => $value) {
> if ($Projects != "") $Projects = $Projects.",";
> $Projects = $Projects."'".$value."'";
> }
> }
> if ($Projects)
> $VendorJobs->ds->SQL.= " AND
> (`VendorJobs`.LocationState IN (".$Projects."))";
> 
> echo "SQL:". $VendorJobs->ds->SQL."<br>";
> 
> return $VendorJobs_ds_BeforeExecuteSelect;
> 
> If you notice in the the SQL the "AND", I've changed
> them back and forth to OR and a combo of AND in the
> first and OR in the second.
> 
> If I have OR in both, then each multi works on it's
> own, no refined / results.  If I have AND in both,
> then they come together but if I try to add more
> values (like a multi select should allow) I get a
> "no
> records" return.
> So something like this using in both AND:
> 
> I choose from Industry : Accounting and Finance
> From LocationState: I choose Alabama
> great it gives back to me all accounting and finance
> records Alabama
> But if I add in LocationState, Alabama and
> California
> then a no records is returned.  
> 
> Anyway, if anyone has some pointers or ideas I'd
> greatly appreciate.
> 
> Stuart
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to