RE: [PEAR] Problem with count(*) in db query
| From: | Sönke Ruempler | Date: | Mon, 08 Nov 2004 09:35:56 +0000 |
| Subject: | RE: [PEAR] Problem with count(*) in db query | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15381@lists.php.net to get a copy of this message | ||
George Pitcher wrote on Monday, November 08, 2004 10:15 AM:
> $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(*)'.
try $db->getOne()
http://pear.php.net/manual/en/package.database.db.db-common.getone.php
> 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"
it's fetchRow()
http://pear.php.net/manual/en/package.database.db.db-result.fetchrow.php
but obviously not what you want here (use getOne).