Ok i have 2 pages here.. An edit page and a send edit page.
Problem i'm having is when i hit adjust(submit) the values goto the next page but do not update the database tables that i have
I think it's my update code that I'm using.. but i'll post both pages
First Page Edit.php
mysql_connect($dbhost,$dbuser,$dbpass) or die("You broke it");
@mysql_select_db("$dbname") or die("You broke the database");
$query="SELECT * from $table";
echo "<center><P><br><br><br><table border='1'>
<tr><td colspan='7'><center>Edit Existing Members</center></td></tr>
<tr>
<th>ID#</th>
<th>Name</th>
<th>Class</th>
<th>Total DKP</th>
<th>Total DKP Spent</th>
<th>Total DKP Earned</th>
<th>Adjust</th>
</tr>";
$query = "SELECT *, total_dkp_earned - total_dkp_spent AS total_dkp FROM $table ORDER BY name Asc";
#$query = "SELECT * FROM $table ORDER BY name Asc";
$result=mysql_query($query);
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row['id'] . "</td>";
echo "<td>" .$row['name'] . "</td>";
echo "<td>" .$row['class'] . "</td>";
echo "<td>" .$row['total_dkp'] . "</td>";
echo "<td>" .$row['total_dkp_spent'] . "</td>";
echo "<td>" .$row['total_dkp_earned'] . "</td>";
echo "<td><form action='edit2.php' method='post'>";
echo "<input type='hidden' name='player_id' value='$row[id]' />";
echo "Add: <input type='text' name='add' value='0' />";
echo "Sub: <input type='text' name='sub' value='0' />";
echo "<input type='submit' value='Adjust' /></form></td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
Second page sendedit.php
From the first page say in the first row i put in 50 50.
On the sendedit.php page I get values coming over that i put in their just not being updated in the tables at all
error_reporting(E_ALL);
mysql_connect($dbhost,$dbuser,$dbpass) or die("You broke it");
@mysql_select_db("$dbname") or die("You broke the database");
$add=$_POST['add'];
$sub=$_POST['sub'];
$id=$_POST['id'];
$total_dkp_spent=$_POST['total_dkp_spent'];
$total_dkp_earned=$_POST['total_dkp_earned'];
$sqlquery = "UPDATE $table SET ('$total_dkp_spent' = '$sub' + 'total_dkp_spent', '$add' = '$total_dkp_earned' + 'total_dkp_earned' WHERE 'id' = '$id')";
$results = mysql_query($sqlquery);
mysql_close();
print "It was sent"
Only 2 fields in the tale are being updated $total_dkp_spent and $total_dkp_earned thats it
I know most likely it's something really small but I can't figure it out