Okay im trying to write the contents of a sql result to a csv file and each row in the db is a new row in the file, it all works but the only problem is that the newest row overwrites the previous one, so at the end i get the last row from the db and thats it.
here is my code, i hope that makes sence? i should have 100 or so values but i only get 1 wich is the last one is in the row, and it all echo correctly on the screen just not to the file, im overwritting the previous row and not creating a new row.
CODE
while ($i = mysql_fetch_assoc($result))
{
$userID = $i['userID'];
$firstName = $i['firstName'];
$lastName = $i['lastName'];
$emailAddress = $i['emailAddress'];
$agentId = $i['agentId'];
$signUpDate = $i['signUpDate'];
$content = $userID.','.$firstName.','.$lastName.','.$emailAddress.','.$agentId.','.$signUpDate.'\n';
echo $content.'<br>';
$FileName = "cmic_report/RegularReport.csv";
$FileHandle = fopen($FileName, 'w') or die("can't open file");
fwrite($FileHandle, $content);
}
fclose($FileHandle);
any help would be great, thanks