Jump to content

Mysql Update


Beffic
 Share

Recommended Posts

So I have a stat point distributor for my game and I cannot seem to get it to work.It keeps returning the value to 0 every time I try to increase my stat points.I have maneuvered this code so much and I cannot figure out why...

<?phpinclude("../../connect.php");include("head.php");?><center><table class="content">  <tr><td>    <?php  $Player=$_COOKIE['player_id'];     if(isset($_POST['distribute'])){     $use=$_POST['use'];     $ammount=$_POST['ammount'];     if($User['StatPoint']<$ammount){      print"You do not have <font color=red>".number_format($ammount)."</font> Stat Points!";     }elseif($use=="health"){      $ammount2=$ammount*2;      mysql_query("UPDATE `Users` SET MaxHealth=MaxHealth+'$ammount2', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'")or die(mysql_error());      print"You raised your Max Health by ".$ammount2."!";     }elseif($use=="energy"){      $ammount2=$ammount*2;      mysql_query("UPDATE `Users` SET MaxEnergy=MaxEnergy+'$ammount2', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Max Energy by ".$ammount2."!";     }elseif($use=="strength"){      mysql_query("UPDATE `Users` SET Strength=Strength+'$ammount', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Strength by ".$ammount."!";     }elseif($use=="wisdom"){      mysql_query("UPDATE `Users` SET Wisdom=Wisdom+'$ammount', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Wisdom by ".$ammount."!";     }elseif($use=="defence"){      mysql_query("UPDATE `Users` SET Defence=Defence+'$ammount', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Defence by ".$ammount."!";     }elseif($use=="dexterity"){      mysql_query("UPDATE `Users` SET Dexterity=Dexterity+'$ammount', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Dexterity by ".$ammount."!";     }elseif($use=="accuracy"){      mysql_query("UPDATE `Users` SET Accuracy=Accuracy+'$ammount', StatPoint=StatPoint-'$ammount' WHERE ID='$Player'");      print"You raised your Accuracy by ".$ammount."!";     }else{      print"No use selected!";     }       }  ?>      <h1>Distribute Stat Points!</h1><br><br>        <p>Here you can distribute your Stat Points gained from Leveling to your User Stats so not everyone will have the same stats all the time. Distribute your way!<br><br>        <?php    print"You have ".number_format($User['StatPoint'])." Stat Points to spend!<br>";    print"<form method=\"post\" action=\"statpointdistributer.php\">Stat Points to use: <input type=\"text\" name\"ammount\"> Use: <select name=\"use\"><option value=\"health\">Max Health X 2</option><option value=\"energy\">Max Energy X 2</option><option value=\"strength\">Strength</option><option value=\"wisdiom\">Wisdom</option><option value=\"defence\">Defence</option><option value=\"dexterity\">Dexterity</option><option value=\"accuracy\">Accuracy</option></select><input type=submit value=\"Distribute\" name=distribute></form>";     ?><br><br>        Would you like to return to your adventure? <a href="index.php">Yes</a>    </p>  </td></tr></table></center>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...