RE: [PEAR] Counting Total DB Rows Used

From: Date: Wed, 28 Apr 2004 20:50:34 +0000
Subject: RE: [PEAR] Counting Total DB Rows Used
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12195@lists.php.net to get a copy of this message
SELECT COUNT(*) AS total FROM table --Joe > -----Original Message----- > From: Roger Spears [mailto:roger@bgnet.bgsu.edu] > Sent: Wednesday, April 28, 2004 4:42 PM > To: PEAR Mailing List > Subject: [PEAR] Counting Total DB Rows Used > > > Hello, > > I'm wondering if there is a PEAR function or command to use > for counting > to total number of rows used in a database. > > Currently I'm using this code, but I'm afraid it's not on par > with the > best practices available: > > $result = $db->query("SELECT * FROM myTable"); > if (DB::isError($result)) > { > die ($result->getDebugInfo()); > } > > while ($result->fetchInto($row)) > { > $rowCounter ++; > } > print "<p>Total Submissions: ".$rowCounter."<br>"; > > Thanks, > Roger > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pear.general (#12195) next »