} 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': if (empty($oldRating)) { error_log("If you wish to update a previous rating, please specify an oldRating in the parameters."); print 'NO OLDRATING SPECIFIED.'; return false; } else { if (empty($newRating)) { error_log("If you wish to update a previous rating, please specify a newRating in the parameters."); print 'NO NEWRATING SPECIFIED.'; return false; } else { $ratings->updateRatings($id, $oldRating, $newRating);