For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2004 > RE: [PEAR] Counting Total DB Rows Used









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PEAR] Counting Total DB Rows Used
Joe Stump

2004-04-28, 5:38 pm

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
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com