Reply to Re: mysql query - select any

Your name:

Reply:


Posted by naixn on 12/03/06 18:37

alex.kemsley wrote :
> Hi guys,
>
> I have the following sql statemant to search a mysql database that gets
> if values from a form with combo box's in.
>
> SELECT * FROM hottubs, manufacturers WHERE manufacturers.manid =
> hottubs.manid AND hottubs.type = '%s' AND hottubs.dimlength <= '%s' AND
> hottubs.dimwidth <= '%s' AND hottubs.dimhight <= '%s' AND
> hottubs.seatsto <= '%s' AND hottubs.shape = '%s' ORDER BY
> $thesearchtype_search.
>
> Everything works fine except I want to add a select "any" from the
> shape combo box. I really need a way of cutting out the last " AND
> hottubs.shape = '%s' " if the $_GET['shape'] = 'any'
> Will this work using a variable as shown below??
>
> IF ($_GET['shape'] != 'any' )
> {
> $shape = AND hottubs.shape = '%s'
> }
>
> SELECT * FROM hottubs, manufacturers WHERE manufacturers.manid =
> hottubs.manid AND hottubs.type = '%s' AND hottubs.dimlength <= '%s' AND
> hottubs.dimwidth <= '%s' AND hottubs.dimhight <= '%s' AND
> hottubs.seatsto <= '%s' $shape ORDER BY $thesearchtype_search
>
> I have only been doing php about a month so go gentle!
>
> Alex
>

Well, I just looked a bit, that should work.
But you know, the best way to know if it works is to test it yourself :)

--
Naixn
http://fma-fr.net

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация