As the name says I’m trying to update/change values in tables but for some reason its not working.
Heres my form:
<?php
$username = $_SESSION['name'];
mysql_connect("localhost", "root", "*********************");
@mysql_select_db("accounts") or die( "Unable to select database");
$query = mysql_query ("SELECT * FROM skills WHERE playerName='".$username."'") or die(mysql_error());
$row = mysql_fetch_array($query);
echo '<h1>Your Current Stats</h1>
<form method="POST" action="resetSkillsFunction.php">
<span style="color:#FFFFFF;">
<b>Attack Lvl:XP - '.$row["Attacklvl"].':'.$row["Attackxp"].'</b>
<input type="hidden" name="skill" value="Attack"/>
<input type="submit" value="Reset Skill" name="submit"/>
</span>
</form>
';
?>
heres my function:
[code]<?php
$username = $_SESSION[‘name’];
$skill = $_POST[‘skill’].‘lvl’;
$skillxp = $_POST[‘skill’].‘xp’;
mysql_connect(“localhost”, “root”, “********************”);
@mysql_select_db(“accounts”) or die( “Unable to select database”);
$query = mysql_query (“SELECT * FROM skills WHERE playerName=’”.$username."’") or die(mysql_error());
echo $username.’ ‘.$skill . ’ ’ . $skillxp;
mysql_query("UPDATE skills SET ‘.$skill.’ = 1, ‘.$skillxp.’ = 0 WHERE playerName=’".$username."’");
mysql_close();
?>[/code]
The rows im updating are named Attacklvl and Attackxp in the database.