RE: [PHP-DB] element in the SELECT query

2001-04-12 Thread Steve Brett

pg_numrows will only bring back the number of results in the resultset.

you could try:

a. a query using distinct to bring only the vlaues you want.

b. (better) a query using an aggregate function like count and then access
the count var from your resultset.

like:

select count(id) as idcount from blah blah blah
.. and then idcount will be available from fetch_row or fetch_array etc.

Steve

> -Original Message-
> From: phobo [mailto:[EMAIL PROTECTED]]
> Sent: 11 April 2001 21:46
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] element in the SELECT query
> 
> 
> you should look at php.net. Having never used postgres, my imagination
> thinks that perhaps 
> http://www.php.net/manual/en/function.pg-numfields.php
> is what you're after.
> 
> and btw, if you're fetching a whole row, don't retreive a 
> field at a time -
> its very slow. use a fetch_array or something.
> 
> siggy
> 
> 
> - Original Message -
> From: "Sharmad Naik" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 12, 2001 7:59 AM
> Subject: [PHP-DB] element in the SELECT query
> 
> 
> > say u say a query like
> > SELECT * from user where user='sharmad';
> > Is there any variable like pg_Result that will count the number of
> differnet
> > values in * ?
> > like i wanted to give something like
> > for($i=0;$i > for ($j=0;$j<***Tell me what to put here *** ;$j++){
> > echo pg_Result($result,$i,$j);
> > }
> > }
> > -Regards
> >
> > --
> > The secret of the universe is @*&!'^#+ NO CARRIER
> > ___  _  _  _
> > |_|_||_||_||\/||_|| \
> > _|| || || \|  || ||_/
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> >
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] element in the SELECT query

2001-04-11 Thread phobo

you should look at php.net. Having never used postgres, my imagination
thinks that perhaps http://www.php.net/manual/en/function.pg-numfields.php
is what you're after.

and btw, if you're fetching a whole row, don't retreive a field at a time -
its very slow. use a fetch_array or something.

siggy


- Original Message -
From: "Sharmad Naik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2001 7:59 AM
Subject: [PHP-DB] element in the SELECT query


> say u say a query like
> SELECT * from user where user='sharmad';
> Is there any variable like pg_Result that will count the number of
differnet
> values in * ?
> like i wanted to give something like
> for($i=0;$i for ($j=0;$j<***Tell me what to put here *** ;$j++){
> echo pg_Result($result,$i,$j);
> }
> }
> -Regards
>
> --
> The secret of the universe is @*&í!'ñ^#+ NO CARRIER
> ___  _  _  _
> |_|_||_||_||\/||_|| \
> _|| || || \|  || ||_/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]