use some error checking so you can get some clues about what is going wrong:
Code:
mysql_query($query) or die("ERROR: ".mysql_error());
I would also suggest that your code is lacking terribly in some basics checks. In this case, I think you'll see that your sql command is wrong, in turn becase your $_POST syntax is wrong.
A much more robust set of commands would look something like this:
mysql_query("UPDATE fight SET attacked = '$_POST[opponent]' AND attacking = '$_POST[attacker]' WHERE name = '$_POST[opponent]'");
mysql_query("UPDATE fight SET attacked = '$_POST[opponent]' AND attacking = '$_POST[attacker]' WHERE name = '$_POST[attacker]' ");
Code:
$opponent = $_POST['opponent'];
$attacker = $_POST['attacker'];
if (( strlen($opponent) > 0 ) && ( strlen($attacker) > 0 )) {
$sql = "UPDATE flight SET attacked = '$opponent' AND attacking = '$attacker' WHERE name = '$opponent'";
$result = mysql_query($query) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $sql . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
$sql = "UPDATE flight SET attacked = '$opponent' AND attacking = '$attacker' WHERE name = '$attacker'";
$result = mysql_query($query) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $sql . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
} else {
die("Missing opponent or attacker information; opponent='$opponent' and attacker='$attacker'");
}
I typed this free-hand, so there may be spelling errors, but the point is that you should be doing some checks and taking advantage of built-in error reporting tools.