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:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 9:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] count() problem :D
>
>
> On 27 Apr 2001 19:50:04 -0700, Chris Schneck
> <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
--
PHP General 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]