bineye Posted August 13, 2010 Posted August 13, 2010 I know this isn't related to game making, but does anyone know why I can't get this to work? This is a small snippet of a league table I'm making, and trying to calculate who wins and loses from the total of goals (worth 3 points) and points (worth, well, 1 point) if ((($_POST[goal1]*3) + $_POST[point1]) > (($_POST[goal2]*3) + $_POST[point2])) { $sql="INSERT INTO league (W, Points) VALUES ('1','2') WHERE team = $_POST['home']"; "INSERT INTO league (L, Points) VALUES ('1','0') WHERE team = $_POST['away']"; } Quote
Jordan Palmer Posted August 13, 2010 Posted August 13, 2010 Try using this; <?php # remove obv :P if ((($_POST[goal1]*3) + $_POST[point1]) > (($_POST[goal2]*3) + $_POST[point2])) { $onesql = "INSERT INTO `league` (W, Points) VALUES ('1','2') WHERE `team` = ".$_POST['home'].""; $twosql = "INSERT INTO `league` (L, Points) VALUES ('1','0') WHERE `team` = ".$_POST['away'].""; mysql_query($onesql) or die('OneSQL is broke'); mysql_query($twosql) or die('TwoSQL is broke'); } ?> Report any error's (: Quote
bineye Posted August 14, 2010 Author Posted August 14, 2010 No errors... well there were, but was down to my own stuff. This code worked very well. Thank youuuu!!! :D Quote
Jordan Palmer Posted August 14, 2010 Posted August 14, 2010 No problem. I would highly suggest you secure those $_POST[''] though if you haven't already Quote
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.