Re: Num rows for postgres

From: Date: Tue, 23 Jan 2001 19:34:29 +0000
Subject: Re: Num rows for postgres
References: 1 2  Groups: php.pear 
Request: Send a blank email to php-pear+get-1137@lists.php.net to get a copy of this message
To answer my own question. I needed to add this wrapper function to DB.php to get $sth->numRows() to work. /** * Get the the number of rows in a result set. * * @return int the number of rows, or a DB error code */ function numRows() { return $this->dbh->numRows($this->result); } Regards, Paul > I am using postgres and I am trying to get the number of results returned > by a select query. > > I would have hoped that something like this would work: > > $sql = "SELECT * FROM my_table"; > $sth = $dbh->query($sql); > $num_rows = $sth->numRows(); > echo $num_rows; > > No go however. Does anyone know how to get the number of rows in a result > set using the PEAR database abstraction library? > > Regards, > Paul > > > > > -- > PHP Extension and Add-on Repository (PEAR) mailing list. > Documentation can be found at http://pear.php.net/doc/pear.html > To unsubscribe, e-mail: php-pear-unsubscribe@lists.php.net from the > mail address you subscribed with. > >

« previous php.pear (#1137) next »