RE: [PHP-DB] MultSelect ListBox hell!

2004-09-24 Thread Stuart Felenstein
It's working great! I replaced the former parser with the implode. All is good again in the world! :) Mucho gracias! Stuart --- "Ford, Mike" <[EMAIL PROTECTED]> wrote: > > Mike > > - > Mike Ford, Electronic Information Serv

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-24 Thread Ford, Mike
On 23 September 2004 20:53, Stuart Felenstein wrote: > So here is what I have: > > //Here is defines the field variable and uses > //CodeCharge function to grab the variable > $s_Industry = CCGetParam("s_Industry", ""); > $s_LocationState = CCGetParam("s_LocationState", ""); > $s_TaxTerm = CCGetP

Re: [PHP-DB] MultSelect ListBox hell!

2004-09-23 Thread Stuart Felenstein
Well don't hate me for coming back here. I am shamed and embarassed enough. And while I appreciate all the great code and feedback received , I've run into a glitch. (oi) Because I'm using CodeCharge, it's not easy to just insert custom code anywhere. That is one of those code generators. I s

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-23 Thread Ford, Mike
On 22 September 2004 18:45, Stuart Felenstein wrote: > Just to confirm, > This is what I'm going to start with: Yeah, I'd say you've pretty much got it, except... > //base sql statement > $sql = "select * from jobs where record_deleted = 'NO' "; > > if (isset($_POST['states'])){ Your SQL is g

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
Just to confirm, This is what I'm going to start with: //base sql statement $sql = "select * from jobs where record_deleted = 'NO' "; if (isset($_POST['states'])){ //check to see if the states is an array // multiple items or just one if (is_array($_POST['state'])) $sql .= "state='".implode("' O

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
> -Original Message- > From: Stuart Felenstein [mailto:[EMAIL PROTECTED] > Sent: 22 September 2004 16:45 > > --- "Ford, Mike" <[EMAIL PROTECTED]> wrote: > > > >if (is_array($_POST['state'])){ > > > $sql .= "("; > > > $x = 0; > > > foreach ($_POST['state'] as $state) >

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
> -Original Message- > From: John Holmes [mailto:[EMAIL PROTECTED] > Sent: 22 September 2004 16:39 > > From: "Ford, Mike" <[EMAIL PROTECTED]> > >>if (is_array($_POST['state'])){ > > > > This check isn't really necessary in PHP, since > $_POST['state'] will > > *always* be an array i

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
See mid post: --- "Ford, Mike" <[EMAIL PROTECTED]> wrote: > >if (is_array($_POST['state'])){ > > $sql .= "("; > > $x = 0; > > foreach ($_POST['state'] as $state) > >if ($x == 0){ > >$sql.= "state = '$state' "; > >$x=1; > > }else{ > > $sql

Re: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread John Holmes
From: "Ford, Mike" <[EMAIL PROTECTED]> if (is_array($_POST['state'])){ This check isn't really necessary in PHP, since $_POST['state'] will *always* be an array if the form field has NAME='state[]', even if only 1 is selected. But remember that the form comes from the client. Just because you cr

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Ford, Mike
> -Original Message- > From: Bastien Koert [mailto:[EMAIL PROTECTED] > Sent: 22 September 2004 15:27 [] > //base sql statement > $sql = "select * from jobs where record_deleted = 'NO' "; > > if (isset($_POST['states'])){ >//check to see if the states is an array (multiple items

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
($_POST['job'] as $job ) > > if ($x == 0){ > > $sql.= "job = '$job "; > >$x=1; > > }else{ > > $sql .= " OR job = '$job "; > > } > > $sql .= ")"; > > }else{ &

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
job'] as $job ) >if ($x == 0){ >$sql.= "job = '$job "; >$x=1; > }else{ > $sql .= " OR job = '$job "; > } > $sql .= ")"; > }else{ > //$_POST['job'] is not an array >

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Bastien Koert
if ($x == 0){ $sql.= "job = '$job "; $x=1; }else{ $sql .= " OR job = '$job "; } $sql .= ")"; }else{ //$_POST['job'] is not an array $sql .= "job = '".$_POST['job']."' ";

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
Correct, I've added that AND, and so now it will match jobs by state. But without choosing state, no job return. So I'm figuring i'll have to add another series of OR's . Trying to figure that out now. Stuart --- Bastien Koert <[EMAIL PROTECTED]> wrote: > need to have AND between states and jo

RE: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Bastien Koert
need to have AND between states and jobs select * from tablename where (jobs='accounting' or jobs='bookkeeping') and (state = 'AL' or state='CA') Bastien From: Stuart Felenstein <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [PHP-DB] MultSelect ListBox hell! Date: Wed, 22 Sep 2004 05:19:36 -0

Re: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
The list boxes are fed by tables that have state and state ID, same for industry. So all the joins are made in the main sql statement and working correctly. --- Doug Thompson <[EMAIL PROTECTED]> wrote: > You need LocationState to be, in your example, > Alabama OR California. Also, I would writ

Re: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Doug Thompson
Stuart Felenstein 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 c

Re: [PHP-DB] MultSelect ListBox hell!

2004-09-22 Thread Stuart Felenstein
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 mult