I have a while statement that inserts information into a DB when the page loads. The problem is that for some reason it inserts 2 records instead of just one. I'm not sure what is causing this problem but it's driving me nuts and I need some help. Here is my code: [code] while ($hex = mysql_fetch_array($getHex)) { $hexid1= $hex['Hex_Id']; $hextype1 = $hex['Hex_Type']; $hexNumber1 = $hex['HexNumber']; $hexgranted1 = $hex['Granted']; $hexanimal1 = $hex['animal']; $hexmineral1=$hex['mineral']; $hexvegetable1=$hex['vegetable']; $hexpop=$hex['Population']; $hexdominion1=$hex['Dominion_Id']; $totalhexpop = $totalhexpop + $hexpop; //Total hex that will be added to the Total Dominion Population $month = $row_getHistory['Month']; $year = $row_getHistory['Year']; $totalmonths = 12; ///////////////////////////////////////////////////////// //Advances month by one unless month = 12 then it increases the years by one. if($month == $totalmonths){ $month = 1; $year = ($year +1); }else{ $month = $month + 1; } //////////////////////////////////////////////////////////////// if($hexgranted[$i] ==1){$totalgranted = $totalgranted+1; } $newpop = HexPopCal($hexpop); $hexmonth1=$month; $hexyear1=$year; $hexinsert ="INSERT INTO historyhex (Hex_Id, Dominion_Id, HexNumber, HexType, animal, vegetable, mineral, Population, Month, Year) VALUES ('$hexid1','$hexdominion1', '$hexNumber1', '$hextype1', '$hexanimal1', '$hexvegetable1', '$hexmineral1', '$newpop', '$hexmonth1', '$hexyear1')"; mysql_select_db($database_Norwold, $Norwold); $Result1 = mysql_query($hexinsert, $Norwold) or die(mysql_error()); } [/code] I have searched the forums but I have found nothing that relates to my problem. Hopefully one of the gurus and help me out. Thanks