Re: creating a SELECT AND query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, April 18, 2006 6:03 am, Ross wrote:
> select name="area" class="text" id="area">
>             <option value="a">All of Scotland</option>
>             <option value='1'>Aberdeen City Counci...</option>
>                                </select>
>
>
> This is what I thought would work..
>
>
> $query1= "select * from $table_name WHERE sname LIKE '$search_string%'
> ";
>
> if ($area="a")  {
> $query1 .=" AND area='a'";

If $area is 'a', they want ALL of Scotland.

Since your table probably has ONLY Scotland in it, you don't want to
restrict anything there.

For sure, the area isn't going to be 'a' in your table, is it?

Cuz the next line or two seem to indicate that area is a number like
'1' for Aberdeen City Council and so on.

If you're thinking of adding, say, Wales, next month/year, then you
need to have a different field from 'area' and put in the restriction
here for getting just Scotland.

If you just plain don't care about adding anything more ever, you can
just take out the line above.

>  }
>  else {
>   $query1 .="AND area='$area'";
>   }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux