Received: from cr322781-a.ym1.on.wave.home.com (cr322781-a.ym1.on.wave.home.com [24.112.37.89]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA6EpYs96971 for ; Mon, 6 Nov 2000 09:51:34 -0500 (EST) (envelope-from svanegmond@bang.dhs.org) Received: from svanegmond by cr322781-a.ym1.on.wave.home.com with local (Exim 3.16 #1 (Debian)) id 13sncl-0005FJ-00; Mon, 06 Nov 2000 09:51:51 -0500 Date: Mon, 6 Nov 2000 09:51:51 -0500 To: Aguinaldo Fagundes Junior Cc: pgsql-php@postgresql.org Subject: Re: Select count Message-ID: <20001106095151.G19976@bang.dhs.org> Reply-To: svanegmond@home.com References: <35DE6A7B82C8D3119B3B00508B8B7A49FA85B2@PAENTMS1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <35DE6A7B82C8D3119B3B00508B8B7A49FA85B2@PAENTMS1>; from Aguinaldo.Fagundes@vantcom.net on Mon, Nov 06, 2000 at 12:38:46PM -0300 From: Stephen van Egmond X-Archive-Number: 200011/14 X-Sequence-Number: 22 Aguinaldo Fagundes Junior (Aguinaldo.Fagundes@vantcom.net) wrote: > Hi there! > > I could not find in documentation, how I can get the result from a query > using select "count(*)". Today I use a "select * " and after using > pg_numrows and it woks but I want to know:Is there any other way to get this > result? $result = pg_exec($conn, "SELECT count(*) blah blah blah"); $count = pg_result($result, 0, 0); That gets the first variable from the first row, fast. If you're using fetcharray, you can also use the name 'count' I think, or if that doesn't work, label it with "SELECT count(*) as foo" and ask for foo. -- ,,, (. .) +--ooO-(_)-Ooo------------ --- -- - - - - | Stephen van Egmond http://bang.dhs.org/