} //var_dump($id_sent); if (!$voted) { //if the user hasn't yet voted, then vote normally... if ($vote_sent >= 1 && $vote_sent <= $units) { $updateRate = new Ratings(); $result = $updateRate->updateRating($added, $sum, $insertIP, $id_sent); if ($result) { setcookie("rating_" . $id_sent, 1, time() + 2592000, '/'); } } } //end for the "if(!$voted)" // these are new queries to get the new values! $disAll = new Ratings(); $numbers = $disAll->displayValues($id_sent); //$numbers = mysql_fetch_assoc($newtotals); $count = $numbers['total_votes']; //how many votes total $current_rating = $numbers['total_value']; //total number of rating added together and stored $tense = $count == 1 ? "vote" : "votes"; //plural form votes/vote // $new_back is what gets 'drawn' on your page after a successful 'AJAX/Javascript' vote if ($voted) { $sum = $current_rating; //storing total_value from database to new varibale $added = $count; //storing total_votes from database to new varibale } $new_back = array();