$ratings = new ratings($dbConnection); // instance of ratings class with which to write and read to db. $query = $_GET["query"]; $id = $_GET["id"]; $oldRating = $_GET["oldRating"]; $newRating = $_GET["newRating"]; $outputcontent = ""; if (empty($id)) { error_log("Please specify the id parameter."); print 'ID NOT SPECIFIED.'; return false; } switch ($query) { case 'avg': // the average rating will be printed to the page $outputcontent = $ratings->getAverageRating($id); if ($outputcontent === 0) { $outputcontent = "There are not enough ratings to show an average rating for this college."; } break; case 'add': if (empty($newRating)) { error_log("If you wish to add a new rating, please specify a newRating in the parameters."); print 'NO NEWRATING SPECIFIED.'; return false; } else { $ratings->addToRatings($id, $newRating); print 'Success!'; } break; case 'update':