[ciapug] Adodb: RecordCount()
Chris Hettinger
ciapug@cialug.org
Fri, 24 Oct 2003 09:54:25 -0500
Okay, I hadn't read it well enough, and I didn't realize I could do the =
count() at the same time I was pulling the result set. I have used =
count() before but in it's own query... thanks I will definately =
remember that.
also, I got RecordCount to work, it was again something I overlooked... =
thanks for replies. "it is a function for the record set Not the =
connection..." is what made the difference.=20
Thanks Laith.
-----Original Message-----
From: Lathrop Preston [mailto:laith@prestonfam.org]
Sent: Friday, October 24, 2003 9:50 AM
To: ciapug@cialug.org
Subject: Re: [ciapug] Adodb: RecordCount()
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.
>=20
> Thanks Laith.
>=20
> -----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()
>=20
>=20
>=20
> This is ugly but it should work in most db
>=20
> "SELECT *, count(*) as foo_cn FROM states";
>=20
> As far as RecordCount goes... it is a function for the record set Not=20
> the connection...
>=20
> use
>=20
> $count =3D $results->RecordCount();
>=20
> Laith
>=20
> Chris Hettinger wrote:
>=20
>=20
>>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 =3D "SELECT * FROM states";
>>$results =3D $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 =3D RecordCount($sql);
>>
>>or
>>
>>$count =3D $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
>=20
>=20
>=20
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>=20
>=20
> 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.'
>=20
> _______________________________________________
> 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.'