Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aEbV6-0006K9-QZ for pgsql-php@arkaria.postgresql.org; Thu, 31 Dec 2015 11:34:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aEbV6-0002et-DT for pgsql-php@arkaria.postgresql.org; Thu, 31 Dec 2015 11:34:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aEbV6-0002en-3b for pgsql-php@postgresql.org; Thu, 31 Dec 2015 11:34:36 +0000 Received: from teladesign.vm.bytemark.co.uk ([89.16.172.204]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aEbV3-0005tD-0U for pgsql-php@postgresql.org; Thu, 31 Dec 2015 11:34:35 +0000 Received: from [93.107.231.214] (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 1aEbV0-0001iy-Ti; Thu, 31 Dec 2015 11:34:31 +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: <5682B63E.9030008@iol.ie> <5682BBF3.1020605@iol.ie> <5682C041.40706@iol.ie> <5682CE53.1030409@iol.ie> <5682DEF5.90909@iol.ie> <56830DAA.5040301@iol.ie> To: Killian Driscoll , PostgreSQLPHP From: Raymond O'Donnell X-Enigmail-Draft-Status: N1110 Message-ID: <568512BE.9070105@iol.ie> Date: Thu, 31 Dec 2015 11:34:22 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.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 30/12/2015 08:41, Killian Driscoll wrote: > On 29 December 2015 at 23:48, Raymond O'Donnell > wrote: > > On 29/12/2015 19:33, Killian Driscoll wrote: > > > I'm afraid I don't know whatever framework you're using. Have you any > > way of getting it to generate the actual SQL query? > > > > > > No, it's a php generator, so my only option is to put in the WHERE > > clause in the option box provided, but from the produced php, it looks > > like it's going in the wrong option box..... > > Hmm, afraid I can't help you with that, so, as I don't know what you're > using. > > > I'm using Maestro php generator (I have v. little experience with > postgresql or php: I'm an archaeologist....). > > As a possible workaround, I have created a view with a DISTINCT ON that > gives the rows from the lookup table that are used to date, and then in > the php generator I can link the lookup table's type_id to that view > when building the filter. It works, but I'm concerned that this may be > 'messy' or bad practice: any thoughts? Well, you're always going to be limited by whatever the generator does, so it really comes down to tricking it into giving you what you want - so in this case I wouldn't worry about messiness as long as the results are right. :-) 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