You are here: Re: build WHERE clause on demand « PHP SQL « IT news, forums, messages
Re: build WHERE clause on demand

Posted by rich on 10/13/38 11:31

In article <3LedndYzjMDWf-3enZ2dnUVZ_tSdnZ2d@rogers.com>, shawn says...
>
>Hi I have a situation where the user will choose a subset of a list of items
>and display by submitting request. For example I have apple, orange and
>pear. A user may select apple and pear, or orange and pear or all etc.
>
>How to I contruct the WHERE clause?
>
>SELECT fruit_name, price FROM fruit_table WHERE fruit_name = .....
>
>Can you help?
>
>Thanks!
>
>Shawn
>
>

You could use a form to get the user selection, such as...

$fruit_name = $_GET['fruit_name'],

Then build a query with that similar to..

$query = "select * from fruit_table where \'$fruit_name\'";

Rich
--
Newsguy -- http://newsguy.com

 

Navigation:

[Reply to this 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

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