php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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!!" );
                exit;
        }

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC