ohdang888 Posted March 23, 2008 Share Posted March 23, 2008 this is my rating, system, fairly simple.... There's no errors shown, but when i look at the new values in PhpMyAdmin, it didn't update it. <?php $vote = mysql_real_escape_string($_POST['vote']); $result = mysql_query("SELECT `score`, `votes` FROM `vote` WHERE `game` = '{$game}' ")or die(mysql_error()) $poll = mysql_fetch_array($result); $new_score = $poll['score'] + $vote; $new_vote_total = $poll['votes'] + 1; $a = $new_score/$new_vote_total; $new_rating = round($a, 2); mysql_query("UPDATE `vote` SET `score` = (score + {$vote}), `votes`= (votes + 1), `rating`='{$new_rating}' WHERE `game`='{$game}' ") or die(mysql_error()); ?> and the vote script is: <form action="action.php?action=vote&game=<?php echo $game ?>" method="POST"> <input type="radio" name="vote" value="1"> 1<br> <input type="radio" name="vote" value="2"> 2<br> <input type="radio" name="vote" value="3"> 3<br> <input type="radio" name="vote" value="4"> 4<br> <input type="radio" name="vote" value="5"> 5<br> <input type="submit" value="Vote!"> </form> thanks for your help! Quote Link to comment Share on other sites More sharing options...
toplay Posted March 24, 2008 Share Posted March 24, 2008 From the code posted, I don't see where you set $game !! Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Author Share Posted March 24, 2008 sorry.... thats up higher, i get it from the url... but i know this function works fine, because it directs me back to the game page, it just isn't updating. function sql_quote($data) { if (get_magic_quotes_gpc()) { $data = stripslashes($data); } return addslashes($data); } $game = mysql_real_escape_string(sql_quote($_GET['game'])); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.