|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4087 Pg_NumRows() 1 when no data is stored.
Submitted: 2000-04-09 22:58 UTC Modified: 2005-03-31 16:13 UTC
From: uezaki at sra dot co dot jp Assigned:
Status: Wont fix Package: PostgreSQL related
PHP Version: 3.0.14 OS: AIX Version 4.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: uezaki at sra dot co dot jp
New email:
PHP Version: OS:


 [2000-04-09 22:58 UTC] uezaki at sra dot co dot jp
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!!" );

        // Get the number of rows
        $num=pg_NumRows( $id ) ;
        if ( !$num ) {
                echo "No record is registered!!" );
        } else {
                echo( $num );


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-31 16:13 UTC] php-bugs at lists dot php dot net
We are sorry, but we do not support PHP 3 related problems anymore.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 04:03:37 2021 UTC