Re: Average of column...
| From: | infoz | Date: | Tue, 10 Jul 2001 15:45:38 +0000 |
| Subject: | Re: Average of column... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57171@lists.php.net to get a copy of this message | ||
You can name the pseudo-column by doing "select AVG(age) as avgage from ..."
and then accessing it as "avgage".
- Tim
http://www.phptemplates.org
----- Original Message -----
From: "Jeff Lewis" <jeff@hyrum.net>
To: <php-general@lists.php.net>
Sent: Tuesday, July 10, 2001 11:27 AM
Subject: [PHP] Average of column...
> I am trying to obtain the average age for a few teams in my database.
> $age_result = mysql_query("select AVG(age) FROM bat_rost WHERE ownerID =
> '$teamID'");
> while(($row = mysql_fetch_object($age_result))){
> $age=$row->age;
> echo "Average age - ".$teamID.$age;}
>
> How can I get the average age from this?