Using Pg's error message

From: Greg Flanders <gflan(at)avalon(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Using Pg's error message
Date: 1998-08-26 21:22:41
Message-ID: Pine.LNX.3.96.980826162134.13852A-100000@darwin.xdsl.avalon.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm using the Pg package that came with 6.3, and I'm having problems using the
error codes generated by $result->resultStatus. Basically I just want to know
if a query came back null before I try to use it. Here's the code

$result = $conn2->exec("select totalusage from usage where name =
\'$username\'\;");

if ($result->resultStatus == PGRES_EMPTY_QUERY)
{
print "BAD VOODOO!\n";
}

The error message I continue to receive on empty queries is

PQgetvalue: There is no row 0 in the query results. The highest numbered row
is -1.

Can anyone tell me what I'm doing wrong here, and point me in the right
direction to using the error codes correctly?

thanks a ton!

greg

Browse pgsql-general by date

  From Date Subject
Next Message Daniele Orlandi 1998-08-27 16:31:57 How do I change the owner of a table ?
Previous Message J Christopher Bower 1998-08-26 18:24:18 Database corruption - postgres 6.3.2