[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<title>zakgeld</title>
	</head>
	<body>
<table border="1">
<?php
echo "<tr><td><b>naam</b></td><td><b>per week</b></td><td><b>totaal(week ".date("W").")</b></td></tr>";
$numofmen = 0;
$total = 0;
$totalperweek = 0;
mysql_connect("••••", "••••", "••••") or die(mysql_error());
mysql_select_db("••••") or die(mysql_error());

if(isset($_POST['name']) && isset($_POST['europerweek']) && isset($_POST['current']) && $_POST['name'] != "" && $_POST['europerweek'] > 0 && is_numeric($_POST['europerweek']) && is_numeric($_POST['current']) && !is_numeric($_POST['name']) && $_POST['current'] < 10000 && $_POST['europerweek'] < 1000 ) {
mysql_query("INSERT INTO zakgeld (last_update,name,per_week,current) VALUES ('".date("W")."','".mysql_real_escape_string ($_POST['name'])."','".mysql_real_escape_string ($_POST['europerweek'])."','".mysql_real_escape_string ($_POST['current'])."')") or die(mysql_error()); 
echo "Gefeliciteerd, je bent toegevoegd aan onze database.<br />";
}


if(isset($_POST['name']) && ($_POST['name'] == "" || is_numeric($_POST['name'])))
echo "Uw naam is ongeldig.<br />";

if( isset($_POST['current']) && isset($_POST['europerweek']) && (!is_numeric($_POST['europerweek']) || !is_numeric($_POST['current'])))
echo "Bedragen mogen alleen getallen en '.' bevatten.<br />";

if(isset($_POST['europerweek']) && isset($_POST['current']) && ($_POST['current'] >= 10000 || $_POST['europerweek'] >= 1000 || $_POST['europerweek'] <= 0 || $_POST['current'] < 0))
echo "Het door u opgegeven bedrag ligt buiten de maximale/minimale waarde.<br />";

$result = mysql_query("SELECT * FROM zakgeld")
or die(mysql_error()); 

while($row = mysql_fetch_array( $result )) {

mysql_query("UPDATE zakgeld SET last_update='".date("W")."', current='". ((date("W") - $row['last_update']) * ($row['current'] + $row['per_week']) + $row['current']) ."' WHERE name='".$row['name']."'") 
or die(mysql_error()); 

echo "<tr><td>"; 
echo htmlspecialchars ($row['name']);
echo "</td><td>&euro;"; 
echo htmlspecialchars ($row['per_week']);
echo "</td><td>&euro;"; 
echo htmlspecialchars ($row['current']);
echo "</td></tr>"; 
$numofmen++;
$total+= $row['current'];
$totalperweek+= $row['per_week'];
}
echo "<tr><td><b>totaal</b></td><td>&euro;".$totalperweek."</td><td>&euro;".$total."</td></tr>";
echo "<tr><td><b>gemiddeld</b></td><td>&euro;".($totalperweek / $numofmen)."</td><td>&euro;".($total / $numofmen)."</td></tr>";
?>
</table>

<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
naam:<br /><input type="text" name="name" /><br />
zakgeld per week:<br /><input type="text" name="europerweek" /><br />
ik heb nu:<br /><input type="text" name="current" /><br />
<input type="submit" value="submit" /><br />
</form>
<p>
	<a href="http://validator.w3.org/check?uri=referer"><img
		src="http://www.w3.org/Icons/valid-xhtml10"
		alt="Valid XHTML 1.0 Transitional" height="31" width="88" />
	</a>
</p>

	</body>
</html>
[/code]