Received: from ms1.nypost.com ([208.248.87.251]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6QIVNf60001; Thu, 26 Jul 2001 14:31:23 -0400 (EDT) (envelope-from hjohnson@nypost.com) Received: from website (172.16.12.157) by ms1.nypost.com (Worldmail 1.3.167); 26 Jul 2001 14:31:46 -0400 Message-ID: <012901c11601$1e1bc7c0$9d0c10ac@1211.nypost.com> From: "Heather Johnson" To: Cc: , References: Subject: Re: Re: how to determine where a select statement fails Date: Thu, 26 Jul 2001 14:30:59 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Archive-Number: 200107/29 X-Sequence-Number: 486 Thanks for the suggestion! I don't really want to do that though b/c the table that I'm searching is pretty large. I was hoping to do only one query on the table and then put some indexes on the fields to improve performance. But I can't think of a way to structure my code so that I can do just one query AND get info about which user-entered values don't find a match. (Brent Matzelle suggested that this isn't really a "failure" of the query, and I guess he's right, so hopefully this describes what I'm talking about a little better). Heather ----- Original Message ----- From: To: "Heather Johnson" Cc: ; Sent: Thursday, July 26, 2001 11:35 AM Subject: [PHP] Re: how to determine where a select statement fails > > other than putting an if statement and doing 3 more queries, I can't think > of anything > > something like: > if(pg_numrows == 0) > { > select * from table where streetname = streetname > if(pg_numrows == 0) > { > you found your error > } > else > { > do another query......... > } > } > > Tim. > > Timothy P. Maguire > Web Developer II > Harte-Hanks > 978 436 3325 > > > > > "Heather Johnson" > > > cc: > Sent by: Subject: how to determine where a select statement > pgsql-php-owner@post fails > gresql.org > > > 07/26/01 11:15 AM > > > > > > > I am using php to do a select query which returns rows on the condition > that > a conjunction is true in the WHERE clause. This is the SELECT statement: > > SELECT low_range, high_range, st_name, city, zip FROM router > WHERE st_name = '$st_name' AND city = '$city' AND zip = '$zip'; > > In the event that the query fails to return any rows, I'd like to be able > to > determine which conjunct caused it to fail. So, for example, if the > user-entered $st_name isn't in the router table, I'd like to know that > st_name = '$st_name' is what made the conjunction false and caused the > query > to fail. $pg_errormsg isn't this specific about query failures though. Does > anyone know how I might be able to get this information? > > Thanks! > Heather Johnson > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly