0) { $post = mysql_fetch_object($result); $votes = $post->votes + 1; $score = $post->score + ($rating / $votes); $result2 = mysql_query("UPDATE post SET votes = $votes, score = $score WHERE id = $postId"); if ($result2) { show_result_page(true, $post); } else { show_result_page(false, $post); } } else { show_result_page(false, NULL); } } else { show_result_page(false, NULL); } } function show_result_page($success, $post) { if ($success) { doHeader("Vote Registered"); echo "Vote Registered"; echo "
Your rating has been successfully recorded. Thank you for your input.
"; } else { doHeader("Vote Submission Problem"); echo "Vote submission failed"; if ($post) { echo "There was a problem recording your vote in our database. Please try again later.
"; } else { echo "There post you specified does not exist.
"; } } doFooter(); } ?>