[ciapug] Adodb: RecordCount()

Lathrop Preston ciapug@cialug.org
Fri, 24 Oct 2003 09:49:51 -0500


that is why I had it be "SELECT *, count(*) AS Foo_cn...."

this should place the count as the column 'foo_cn' in every row returned 
from the query.

so not a second query.

Lathrop

Chris Hettinger wrote:

> Thanks will try it that way. I did consider using "SELECT count()..." But I still need to the results set and am trying to limit the numbers of DB hits... so if I can count it without another db query that would be best.
> 
> Thanks Laith.
> 
> -----Original Message-----
> From: Lathrop Preston [mailto:laith@prestonfam.org]
> Sent: Friday, October 24, 2003 9:30 AM
> To: ciapug@cialug.org
> Subject: Re: [ciapug] Adodb: RecordCount()
> 
> 
> 
> This is ugly but it should work in most db
> 
> "SELECT *, count(*) as foo_cn FROM states";
> 
> As far as RecordCount goes... it is a function for the record set Not 
> the connection...
> 
> use
> 
> $count = $results->RecordCount();
> 
> Laith
> 
> Chris Hettinger wrote:
> 
> 
>>I am having a small issue with the Adodb (version 4.01) function RecordCount().
>>Here is the documentation on this function: http://phplens.com/lens/adodb/docs-adodb.htm#recordcount
>>
>>Example:
>>$sql = "SELECT * FROM states";
>>$results = $db->Execute($sql);
>>
>>// result set should then list 50 records
>>
>>I am having an issue with the syntax to use this function.... I would assume I would need pass it my result set or the query??? I have tried several different ways...
>>
>>$count = RecordCount($sql);
>>
>>or
>>
>>$count = $db->RecordCount($sql);
>>
>>... No matter what I try I receive the error: Fatal error: Call to undefined function: recordcount()...
>>
>>I want to know the number of records returned in my result set. I don't want to use a counter and while loop to do this.
>>
>>-Chris Hettinger, Web Specialist
>>-IFMC/ENCOMPASS
>>-www.encompas.com
>>-(515) 279-8730
>>
>>
>>
>>CONFIDENTIALITY NOTICE:  This communication, including any attachment, may contain confidential information and is intended only for the individual or entity to whom it is addressed.  Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited.  If you are not the intended recipient, please contact the sender by reply email, delete and destroy all copies of the original message.'
>>
>>_______________________________________________
>>ciapug mailing list
>>ciapug@cialug.org
>>http://cialug.org/mailman/listinfo/ciapug
> 
> 
> 
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
> 
> 
> CONFIDENTIALITY NOTICE:  This communication, including any attachment, may contain confidential information and is intended only for the individual or entity to whom it is addressed.  Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited.  If you are not the intended recipient, please contact the sender by reply email, delete and destroy all copies of the original message.'
> 
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug