Received: from e-techservices.com (unknown [205.132.149.194]) by postgresql.org (Postfix) with ESMTP id 9E02B475450 for ; Sat, 23 Mar 2002 11:10:07 -0500 (EST) Received: from localhost (jjm@localhost) by e-techservices.com (8.11.6/8.11.0/2.2.0) with ESMTP id g2NG4Le20897 for ; Sat, 23 Mar 2002 11:04:21 -0500 Date: Sat, 23 Mar 2002 11:04:21 -0500 (EST) From: Jim Martinez X-X-Sender: To: Subject: false No rows returned error Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200203/289 X-Sequence-Number: 7168 I am getting a No rows returned error from a php script when there are rows. I can cut and paste the sql statement in the error message into psql and the query returns 17 rows (which is correct). But why doesn't the result set in php seem to have any rows? There are no errors in the apache logs and I don't have access to the posgtres log file. I'm using postgreSQL 7.1.3, apache 1.3.22, php 4.0.6 running on a 2.4.7-10 linux kernel. Below is a code snippet (some lines wrapped, sorry). Thanks in Advance, Jim 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" ); if (!$res){ exit ("post query check failed");} // // 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 $rows = pg_numrows($res) || exit ("No rows returned ".__FILE__ ." line:". __LINE__ . "
sql is $sql" ); // line 36 echo "\n"; for($i=0;$i<$rows;$i++){ echo "\n"; $pin = pg_results($res,$i,'pin'); $section = pg_results($res, $i, 'last_section_completed'); $comment = pg_results($res, $i, 'comment'); $filler = pg_results($res, $i, 'filler'); echo ""; echo "\n"; echo "\n"; } echo "
$pin $section $comment $filler
";