Received: from bast.unixathome.org (bast.unixathome.org [216.187.105.150]) by postgresql.org (Postfix) with ESMTP id 15829475450 for ; Sat, 23 Mar 2002 12:34:49 -0500 (EST) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id D386E3F30; Sat, 23 Mar 2002 12:34:53 -0500 (EST) From: "Dan Langille" Organization: DVL Software Limited To: Jim Martinez Date: Sat, 23 Mar 2002 12:35:14 -0500 MIME-Version: 1.0 Subject: Re: false No rows returned error Reply-To: dan@langille.org Cc: In-reply-to: X-mailer: Pegasus Mail for Windows (v4.01) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Message-Id: <20020323173453.D386E3F30@bast.unixathome.org> X-Archive-Number: 200203/291 X-Sequence-Number: 7170 On 23 Mar 2002 at 11:04, Jim Martinez wrote: > $conn=pg_connect("user=scott"); > > // make sure I'mconnecting to the correc db > echo "database name:". pg_dbname($conn)."\n"; > > if (!$conn){ > exit(" connection failed: " . __FILE__ . __LINE__ . "error: " . > pg_errormessage($conn) ); > } > > $sql = "select pin, last_section_completed, comment from demographics"; > > $res = pg_exec($conn, $sql) || exit ("query failed: ".__FILE__ . __LINE__ > ."
sql is $sql" ); Change the above to this, just to be sure: res = pg_exec($conn, $sql); if (!$result) { echo "query failed: ".__FILE__ . __LINE__ ."
sql is $sql" ); exit; } > if (!$res){ exit ("post query check failed");} BTW: the above if isn't necessary given the above. > > // > // script dies here (line 36), falling to the exit clause. > // A warning is printed also : > // Warning: Supplied argument is not a valid > // PostgreSQL result resource > // in /home/www/test/php_debug.php on line 36 Listen to this error. > $rows = pg_numrows($res) || exit ("No rows returned ".__FILE__ ." line:". > __LINE__ . "
sql is $sql" ); // line 36 -- Dan Langille The FreeBSD Diary - http://freebsddiary.org/ - practical examples