Thank you, the code i have is this: [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <? $date = $_REQUEST["date"]; $div = $_REQUEST["div"]; $teama = $_REQUEST["teama"]; $teamapts = $_REQUEST["teamapts"]; $teamb = $_REQUEST["teamb"]; $teambpts = $_REQUEST["teambpts"]; $con = mysql_connect("localhost","elyttl","PASSSWORD"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("elyttl_2168", $con); mysql_query("INSERT INTO tbl_latres (Date, Divsion, TeamA, TeamA_pts, TeamB, TeamB_pts) VALUES ('$date', '$div', '$teama', '$teamapts', '$teamb', '$teambpts' )"); echo $date . " " . $div . " " . $teama . " " . $teamapts . " " . $teamb . " ". $teambpts; mysql_close($con); $con = mysql_connect("localhost","elyttl","PASSWORD"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("elyttl_2168", $con); if $div ==1; $query="SELECT * FROM tbl_div1 WHERE TeamName = $teama"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $Played=mysql_result($result,$i,"Played"); $Won=mysql_result($result,$i,"Won"); $Drawn=mysql_result($result,$i,"Drawn"); $Lost=mysql_result($result,$i,"Lost"); $G_for=mysql_result($result,$i,"G_for"); $G_asgt=mysql_result($result,$i,"G_asgt"); $Points=mysql_result($result,$i,"Points"); $i++; } $Played = $Played + 1 if ($teamapts > 5) $Won = $Won + 1; elseif ($teamapts == 5) $Drawn = $Drawn + 1; Else $Lost = $Lost + 1; $G_for = $G_for + $teamapts $G_agst = $G_agst + $teambpts $Points = $Points + $teamapts mysql_query("UPDATE tbl_div1 SET Played = '$Played', SET Won = '$Won', SET Drawn = '$Drawn', SET Lost = '$Lost', SET G_for = '$G_for', SET G_agst = '$G_agst', SET Points = '$Points' WHERE TeamName = '$teama'"); else ?> </body>/[/code] the top part works however the bottom part doesn't, it will probally look like it was written by a complete NooB as it has, but you can only learn, i think that it probally all wrong [b]EDITED BY WILDTEEN88: PLEASE USE CODE TAGS ([nobbc][CODE][/CODE][/nobbc]) WHEN POSTING CODE[/B]