Problem with count(*) in db query
| From: | George Pitcher | Date: | Mon, 08 Nov 2004 09:15:22 +0000 |
| Subject: | Problem with count(*) in db query | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15380@lists.php.net to get a copy of this message | ||
Hi,
I'm trying to count some records - quickly. I'm using MySQL.
my query is:
$tranSQL = "select count(*) from transactions where (course_id = 20867 and
hei_action ='')";
$tr_r = $db->query ($tranSQL);
while ($row = $tr_r->fetchRows()){
$tr_count = $row[0];
}
and if I try that query directly onto the database I get '1' in a single
cell named 'count(*)'.
but my pear query produces an error:
"PHP Fatal error: Call to undefined method DB_result::fetchRows() in
C:\Inetpub\wwwroot\Egret\Activepacklist.php on line 163"
I did try using numRows but that was taking too long.
Is count(*) allowable? or is it a different problem?
Cheers
George in Oxford