RE: [PHP] count() problem :D

From: Date: Sat, 28 Apr 2001 05:43:55 +0000
Subject: RE: [PHP] count() problem :D
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50729@lists.php.net to get a copy of this message
Alias the count() $query = "select count(fld_gender) s sumField from tbl_survey"; $result = mysql_query( $query, $dbConnection ); $aRow = mysql_fetch_array( $result ); print( $aRow["sumField"] ); Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= > -----Original Message----- > From: Chris Adams [mailto:chris@improbable.org] > Sent: Friday, April 27, 2001 9:31 PM > To: php-general@lists.php.net > Subject: Re: [PHP] count() problem :D > > > On 27 Apr 2001 19:50:04 -0700, Chris Schneck > <chris@hubcityhosting.com> wrote: > >anywho, im having problems getting data out of the count() function i've > >implemented, could anyone lend a hand? > > > > $query = "select count(fld_gender) from tbl_survey"; > > > >how exactly is it that you output data retrieved from a count() > >implementation? > > The same way you retrieve data from any other query - SQL functions like > count() or sum() return data in the same fashion as normal, > non-computed data. > > As an example: > $foo = mysql_query("select count(*) from table"); > echo "Number of records in table: " . mysql_result($foo, 0); > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#50729) next »