Lamez Posted December 20, 2008 Share Posted December 20, 2008 The idea behind this bit of code is to take the previous submitted information, which are the winners of the foot bowl, then to find all the users that have picked that team to win. If they did pick that team, then it will (suppose) take the pnt value, and add it to the db in the foot_picks table, then take their total, and it it there, and update the foot_pnt table. Well nothing is being updated at all! here is the buggy code: <?php ob_start(); $path = "../../"; $u_login = "yes"; $admin = "yes"; $rank = "yes"; include ($path."main/include/cons/head.php"); $name = $_POST['name']; $team = $_POST['team']; $pnt = $_POST['pnt']; $q = mysql_query("SELECT * FROM `foot_picks` WHERE `team` = '".$team."' AND `bowl_name` = '".$name."'"); while($f = mysql_fetch_array($q)){ mysql_query("UPDATE `foot_picks` WHERE `team` = '".$team."' SET `pnt` = '".$pnt."'"); $t = mysql_query("SELECT * FROM `foot_pnt` WHERE `user` = '".$f['user']."'"); $n = mysql_fetch_array($t); $tot = $n['total'] + $pnt; mysql_query("UPDATE `foot_pnt` WHERE `user` = '".$f['user']."' SET `total` = '".$tot."'"); } echo "All Done!"; include ($path."main/include/cons/foot.php"); ?> Quote Link to comment Share on other sites More sharing options...
RussellReal Posted December 20, 2008 Share Posted December 20, 2008 you could actually turn those two selects into 1 query, but thats for later lol SET usually comes before WHERE although I really don't know if that is really important lol I really don't see much wrong with your code =\ Quote Link to comment Share on other sites More sharing options...
Lamez Posted December 20, 2008 Author Share Posted December 20, 2008 that fixed that, but now I am not able to get the total working. Quote Link to comment Share on other sites More sharing options...
RussellReal Posted December 20, 2008 Share Posted December 20, 2008 you sure the field is called 'total'? Quote Link to comment Share on other sites More sharing options...
Lamez Posted December 20, 2008 Author Share Posted December 20, 2008 ya, I just forgot the refresh the page, lol 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.