You would first have to select all the fields from the post, ie.
PHP Code:
$ratefields = "field1,field2" ; // replace field1 and field2 with the names of the colums from the post table that you want
// seperate entries with a comma
// $postid varibable should be defined before this code
$ratearray = explode ( ",", $ratefields ) ;
$numofrate = count ( $ratearray ) ;
$ratequery = implode ( ", ", $ratearray ) ;
$r = $DB_site->query_first ( "SELECT " . $ratequery . " FROM post WHERE postid=" . $postid ) ;
$totalrate = 0 ;
foreach ( $ratearray AS $rating ) :
$totalrate += $r["$rating"] ;
endforeach ;
$avgrate = round ( $totalrate / $numofrate, 2 ) ;
Has not been tested but should work, if you have any problems I will help you debug it.
Regards,
g-force2k2