$result = mysql_query("SELECT AVG(fieldName) AS avg FROM tableName"); $row = mysql_fetch_assoc($result); echo $row['avg']