[PHP] Average of column...

2001-07-10 Thread Jeff Lewis
I am trying to obtain the average age for a few teams in my database. Am using the below code: $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

Re: [PHP] Average of column...

2001-07-10 Thread infoz
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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 11:27 AM Subject: [PHP] Average

RE: [PHP] Average of column...

2001-07-10 Thread Remo Pini
if you do a $res = mysql_fetch_row($age_result) $res[0] will be the value of AVG(age). -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 5:27 PM To: [EMAIL PROTECTED] Subject: [PHP] Average of column... I am trying to obtain

RE: [PHP] Average of column...

2001-07-10 Thread Jeff Lewis
of column... if you do a $res = mysql_fetch_row($age_result) $res[0] will be the value of AVG(age). -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 5:27 PM To: [EMAIL PROTECTED] Subject: [PHP] Average of column... I am trying

RE: [PHP] Average of column...

2001-07-10 Thread Steve Brett
2001 16:54 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Average of column... This doesn't work: $age_result = mysql_query(select AVG(age) as avgage FROM bat_rost WHERE ownerID = '$teamID'); $row = mysql_fetch_object($age_result); $age=$avgage; echo Average age - .$teamID

RE: [PHP] Average of column...

2001-07-10 Thread Remo Pini
the ' thingys... -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 5:54 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Average of column... This doesn't work: $age_result = mysql_query(select AVG(age) as avgage FROM bat_rost WHERE