rewind(); while($thefile=$maindir->read()) { if(($thefile != ".") AND ($thefile != "..") AND ($thefile != "index.html")) { $myvalue = average2("$datapath/$thefile"); $myvalue = sprintf("%.2f", $myvalue); $file = explode(".", $thefile); $phpfile = "http://www.yourdomain.com/votedir/" . $file[0] . ".php3"; $meta = get_meta_tags($phpfile); $desc = $meta["description"]; // generate the mySQL query $query = "INSERT into avg_tally VALUES (0, "; $query .= "'$myvalue', '$file[0]', '$desc')"; mysql_query($query, $mysql_link); } } $maindir->close(); print("Successfully updated rating table."); ?>