RE: [PHP] Averaging Data from a Database and Automatic Dates

From: Date: Thu, 26 Oct 2000 03:38:08 +0000
Subject: RE: [PHP] Averaging Data from a Database and Automatic Dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22031@lists.php.net to get a copy of this message
Hi Austin, > I am trying to make a product review database, and I want to have > a dynamic > image graph generated (I figured that out). But, I need the average of a > column of numbers in the database, without previously knowing how many > numbers are in the column. Do I do a counting loop, count the number of > entries in that colummn, then add up all the numbers in that column and > divide them by the number of entries? How do you sum all the > numbers in a > column? Thanks in advance. try: SELECT AVG(column_to_average) FROM table; will work with most SQL-driven databases. Cheers, Matthias

« previous php.general (#22031) next »