> ok, here is the code that runs after the submit button is clicked. i now
> suspect that it has something to do with my "if" statements.....
I haven´t really been following this from the beginning, but you seem to
have forgotten something in the first elseif.
$CuisineTemp = 'ALL' should be $CuisineTemp == 'ALL', right?
(one "=" short)
> elseif ($AreaTemp != 'ALL' && $CuisineTemp = 'ALL')
> {
> echo ($AreaTemp);
> echo ($CuisineTemp);
> $query = "SELECT * ";
> $query .= "FROM Restaurant ";
> $query .= "WHERE '$AreaTemp' = Restaurant.Area ";
> $query .= "ORDER BY Restaurant.Price ";
> $mysql_result=mysql_query($query, $db) OR DIE ("died at query");
> --------code here------------
Hope this was what you were looking for...
// Tobias
> }
> elseif (($AreaTemp == 'ALL') AND ($CuisineTemp == 'ALL')) {
>
> $query = "SELECT * ";
> $query .= "FROM Restaurant ";
> $query .= "ORDER BY Restaurant.Price ";
> $mysql_result=mysql_query($query, $db) OR DIE ("died at query");
>
> -------code here-----------
>
> } else{
>
> $query = "SELECT * ";
> $query .= "FROM Restaurant ";
> $query .= "WHERE '$CuisineTemp' = Restaurant.Cuisine AND '$AreaTemp' =
> Restaurant.Area ";
> $query .= "ORDER BY Restaurant.Price ";
> $mysql_result=mysql_query($query, $db) OR DIE ("died at query");
>
> ---------code here-------------
>
>
> -----Original Message-----
> From: Rolf Hopkins [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 12:14 PM
> To: Stinsman, Scott
> Cc: [EMAIL PROTECTED]
> Subject: Re: mySQL/php query help
>
>
> No, this does not help.
>
> All you have provided was the code that does work. From your original
> description, you are able select the various items from the list. That
> means you are actually selecting items in a list. Now, if you said that
the
> only item in either or both lists was ALL then you would have a problem
with
> the code you gave us.
>
> However you said you have a problem after you have selected ALL for both
> lists and tried to get results. This is the code we need to see!! Ie. the
> code that activates after pressing the submit button.
>
> ----- Original Message -----
> From: "Stinsman, Scott" <[EMAIL PROTECTED]>
> To: "'Rolf Hopkins'" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 14, 2001 23:29
> Subject: RE: mySQL/php query help
>
>
> > hey rolf--
> >
> > everything works fine if the user chooses "ALL" in both pop-up menus and
> > also works if they choose "ALL" in at least one of the pop-up menus.
But
> if
> > the user does not choose the "ALL" option in both pop-up menus, it does
> not
> > work properly. i stuck a couple echo statements in the code to see what
> > data was actually in the 2 variables. below is what happened.
> >
> > SELECTIONS VARIABLES
> >
> > ALL/ALL ALL/ALL
> > ALL/Not ALL ALL/Not ALL
> > Not ALL/ALL Not ALL/ALL
> > Not ALL/Not ALL Not ALL/ALL
> >
> > It seems the AreaTemp variable takes the value "ALL" when the
CuisineTemp
> > variable is something other than "ALL".
> >
> > so,in english, the code works in 3 instances and fails in 1. The code
> works
> > if the user wants all cuisines in all areas, all cuisines in a specific
> > area, and a specific cuisine in all areas. but it does not work if the
> user
> > wants a specific cuisine in a specific area and this is because the
> AreaTemp
> > variable remains "ALL".
> >
> > does this help? any suggestions?
> >
> > --scott
> > -----Original Message-----
> > From: Rolf Hopkins [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 13, 2001 8:30 PM
> > To: Stinsman, Scott; [EMAIL PROTECTED]
> > Subject: Re: mySQL/php query help
> >
> >
> > I can't see anything wrong with your code? What exactly is the problem?
> > Aren't the values, from the select statement printing out on your web
page
> > or something? Are you sure you provided the right code?
> >
> > ----- Original Message -----
> > From: "Stinsman, Scott" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, February 13, 2001 23:17
> > Subject: mySQL/php query help
> >
> >
> > > can anyone figure out why the following code works fine when both
select
> > > variables = "ALL" and also when only 1 of the 2 ="ALL" but NOT when
BOTH
> > > select variables equal something other than "ALL"?
> > >
> > > here is the code:
> > >
> > > What area of the city would you like to dine in?
> > > <?php
> > > $db=mysql_connect("localhost", "******", "*********");
> > >
> > > mysql_select_db("*******", $db) OR DIE ("died at connect");
> > >
> > > $query = "SELECT DISTINCT Restaurant.Area ";
> > > $query .= "FROM Restaurant ";
> > > $query .= "ORDER BY Restaurant.Area ASC ";
> > > $mysql_result=mysql_query($query, $db) OR DIE ("died at query");
> > >
> > > $select="<select name=\"AreaTemp\">\n";
> > > $select.="<option value=\"ALL\">ALL</option>\n";
> > > while(list($AreaTemp)=mysql_fetch_array($mysql_result)) {
> > >
> > > $select.="<option value=\"$AreaTemp\">$AreaTemp</option>\n";
> > >
> > > }
> > >
> > > $select.="</select>";
> > > echo "$select";
> > > ?>
> > > <br>
> > > What type of cuisine do you feel like?
> > >
> > >
> > > <?php
> > > $query = "SELECT DISTINCT Restaurant.Cuisine ";
> > > $query .= "FROM Restaurant ";
> > > $query .= "ORDER BY Restaurant.Cuisine ASC ";
> > > $mysql_result=mysql_query($query, $db) OR DIE ("died at query");
> > >
> > > $select="<select name=\"CuisineTemp\">\n";
> > > $select.="<option value=\"ALL\">ALL</option>\n";
> > > while(list($CuisineTemp)=mysql_fetch_array($mysql_result)) {
> > >
> > > $select.="<option
> > > value=\"$CuisineTemp\">$CuisineTemp</option>\n";
> > >
> > > }
> > >
> > > $select.="</select>";
> > > echo "$select";
> > >
> > > ?>
> > >
> > > <br>
> > >
> > > <input type ="submit" value="Go!" name="submit">
> > > <input type="RESET" value="Clear" name="RESET">
> > >
> > > Scott Stinsman
> > > Academic Coordinator
> > > General Internal Medicine
> > > 1215 Blockley Hall
> > > 423 Guardian Drive
> > > Philadelphia, PA 19104-6021
> > > (phone) 215-662-7623
> > > (fax) 215-349-5091
> > > (email) [EMAIL PROTECTED]
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Before posting, please check:
> > > http://www.mysql.com/manual.php (the manual)
> > > http://lists.mysql.com/ (the list archive)
> > >
> > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> > http://www.mysql.com/manual.php (the manual)
> > http://lists.mysql.com/ (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php