Vans Hallden wrote:

Here is one way:
(probably not the best)


I was able to get almost everything working with your help. Thanks!!! :)

average ages for male/female respondents (database column 'age')


SELECT AVG(age) FROM tablename WHERE sex = 'male';
SELECT AVG(age) FROM tablename WHERE sex = 'female';


I have one small problem remaining. With this code:

$male_average_age = mysql_query("SELECT AVG(age) FROM my_database WHERE sex = 'M'");

..I get a strange "Resource id#10" output. I can't figure out why. What am I missing?

You need to fetch the results. http://www.php.net/mysql_fetch_assoc for example.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to