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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
27 - 22 = ?
Subscribe to this entry?

 
 [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 23:01:34 2024 UTC