Re: how to determine where a select statement fails

From: Timothy_Maguire(at)hartehanks(dot)com
To: "Heather Johnson" <hjohnson(at)nypost(dot)com>
Cc: pgsql-php(at)postgresql(dot)org, pgsql-php-owner(at)postgresql(dot)org
Subject: Re: how to determine where a select statement fails
Date: 2001-07-26 15:35:49
Message-ID: OFC3A0F2A1.C6E0CFD5-ON85256A95.0055743E@hartehanks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


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"
<hjohnson(at)nypost(dot)com To: <pgsql-php(at)postgresql(dot)org>
> cc:
Sent by: Subject: how to determine where a select statement
pgsql-php-owner(at)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(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Adam Lang 2001-07-26 15:56:21 Re: how to determine where a select statement fails
Previous Message Heather Johnson 2001-07-26 15:15:06 how to determine where a select statement fails