0) { boxtop("Error"); echo "You Have Already Rated This Tutorial
"; echo ("You Will Be Redirected.."); echo (""); endbox(); }else{ $insert = mysql_query("INSERT INTO ratings (`tid`, `username`, `rating`) VALUES ( '$tutorialid', '$username', '$rating')"); $query = mysql_query("SELECT avg(rating) AS columnaverage FROM ratings"); $row = mysql_fetch_array($query); $totalresults = $row["columnaverage"]; $round = round($round_totalresults, 1); //rounds the average into E.X 8.1 instead of 8.1837 boxtop("Thank You"); bar("Your Rating Has Been Submitted!"); echo "The New Average Rating For This Tutorial is '.$round'
"; echo "You Will Be Redirected.."; endbox(); echo (""); } } else { $rated = mysql_query("SELECT * FROM ratings WHERE username = '$logged[username]', tid = '.$_GET[id]'"); if ($rated == 0) { boxtop("Rate This Tutorial"); echo("
"); endbox(); } } ?>