Bug #4087: Pg_NumRows() 1 when no data is stored.

From: Date: Mon, 10 Apr 2000 02:58:56 +0000
Subject: Bug #4087: Pg_NumRows() 1 when no data is stored.
Groups: php.dev 
Request: Send a blank email to php-dev+get-17765@lists.php.net to get a copy of this message
From: uezaki@sra.co.jp Operating system: AIX Version 4.1 PHP version: 3.0.14 PHP Bug Type: PostgreSQL related Bug description: Pg_NumRows() 1 when no data is stored. Please see attched PHP script sample. When we try to get how many records have been already registered from certain SQL table, usually we can get the correct result except if no record has been registered yet. In that case, pg_NumRows returns 1 instead of 0. I would like you to investigate this problem ASAP. // create SQL script $sql = "select dept_cd, sect_cd, employee_id from employee; $id = pg_Exec( $con, $sql ); if ( !$id ) { echo "SQL cannot be executed!!" ); exit; } // Get the number of rows $num=pg_NumRows( $id ) ; if ( !$num ) { echo "No record is registered!!" ); exit; } else { echo( $num ); }

« previous php.dev (#17765) next »