Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDxF7-0002hH-S8 for pgsql-php@arkaria.postgresql.org; Tue, 29 Dec 2015 16:35:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDxF7-0006pt-5j for pgsql-php@arkaria.postgresql.org; Tue, 29 Dec 2015 16:35:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDxF6-0006pm-Ft for pgsql-php@postgresql.org; Tue, 29 Dec 2015 16:35:24 +0000 Received: from teladesign.vm.bytemark.co.uk ([89.16.172.204]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aDxF3-0001Bb-AO for pgsql-php@postgresql.org; Tue, 29 Dec 2015 16:35:23 +0000 Received: from [109.76.177.57] (helo=[127.0.0.1]) by teladesign.vm.bytemark.co.uk with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aDxF0-0006dO-HZ; Tue, 29 Dec 2015 16:35:18 +0000 Reply-To: rod@iol.ie Subject: Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql References: To: Killian Driscoll , pgsql-php@postgresql.org From: Raymond O'Donnell Message-ID: <5682B63E.9030008@iol.ie> Date: Tue, 29 Dec 2015 16:35:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-php Precedence: bulk Sender: pgsql-php-owner@postgresql.org On 29/12/2015 16:23, Killian Driscoll wrote: > I have a table country with a lookup table to country_type. > > table country > > country_id (pk), col2, col3, country_type_id (fk) integer > > lookup table > > country_type country_type_id (pk), type_name varchar > > My lookup table has 50 country types, but only 20 are 'in use' in the > current db (with the rest possibly used later as the db expands). On the > webpage I am creating (I am using a php generator) I can set it up to > add a filter by country type based on the country type_name varchar - so > one can view the country types by name rather than the id integer - but > all 50 types are listed. > > I only want the 20 that currently 'in use' (not sure if this is the best > way to describe it) and therefore relevant to searches/filters (i.e. I > don't want to see a "There are no records to display" message). How do you define "in use"? Is it a switch turned on and off by an admin? is it based on how often that country is chosen by a user? Maybe something else? Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie -- Sent via pgsql-php mailing list (pgsql-php@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php