Average?

From: Date: Thu, 16 Nov 2000 00:48:39 +0000
Subject: Average?
Groups: php.db 
Request: Send a blank email to php-db+get-4457@lists.php.net to get a copy of this message
I am making an area of the site where members can rate specific resources. They can add a comment for the rating. I am trying to make a seperate table that contains the average of all the ratings, so I can easily display the top-ranked articles. Here is my table structure : Table Comments CommentID(key) ArticleID User Comment Rating Table Rating ArticleID Article_Name Rating Right now, I am trying to find out how to get an average of all the ratings of the specified ArticleID, and then insert it into the Ratings Table. I tried to use numrows to find what I should divide by, but if I fetch my results in an array, I can divide $rate["rating"] by 5.... What are the solutions to this?

« previous php.db (#4457) next »