PHP-Code:
$sql = "SELECT
id,
name,
spiel,
gewonnen
FROM
runde1 ORDER BY id";
$result = mysql_query($sql) OR die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
$gewonnen = $row['gewonnen']. "";
$id = $row['id']. "";
$name = $row['name']. "";
?>
<table width="200" bordercolor="#FFFFFF" bgcolor="#000000">
<tr>
<form name="los" method="post" action="">
<td>
<div align="left"><strong>
<input name="id" type="text" value="<?php echo "$id";?>">
<br>
<?php echo "$name"; ?> <font color="#FF0000">Gewonnen:</font><?php echo "$gewonnen"; ?></strong></div>
<input type="submit" name="submit" value="Gewonnen">
</td>
</form>
</tr>
</table>
<?php
if (isset($_POST['submit'])) {
mysql_query("UPDATE runde1 SET gewonnen='".($gewonnen+1)."' WHERE id='$id'");
}
}
mysql_close($conn);
?>
Kommentar