On 18/04/06, Ross <[EMAIL PROTECTED]> wrote:
>
> $query1= "select * from $table_name WHERE sname LIKE '$search_string%' ";
>
> if ($area="a")  {
> $query1 .=" AND area='a'";
>  }
>  else {
>   $query1 .="AND area='$area'";
>   }

Firstly, you're assigning "a" to area rather than testing whether
$area is "a". You need a "==" operator, not a "=".

Secondly, even if you were testing $area properly, you're doing the
same thing in both halves of the if-statement. Which isn't very
useful.

Really, you only need the "AND area='?'" part if $area is not equal to "a":

if ($area != "a") {
   $query1 .= " AND area='$area'";
}

  -robin

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

Reply via email to