Below is the basic code I am using. I am trying to convert data from my database into a csv file with two commas breaking up three pieces of information, like this...
email,name,password
This part is no problem. I then want to create many other rows so that it appears like this...
row1_email,row1_name,row1_password
row2_email,row2_name,row2_password
row3_email,row3_name,row3_password
My problem is that all the info is appearing on one row with the coding for any new line break or return that I use appearing as part of the info. Any suggestions?
<?
$sql = mysql_query("SELECT username, password, email from table where something='$something'") or die (mysql_error());
while ($row = mysql_fetch_array($sql)){
$email = $row['email'];
$sentto = $row['username'];
$code = $row['password'];
$array = array("$email","$sentto","$code");
$comma_separated = implode(",", $array);
$file = fopen("messagenotification3.csv","a");
@fwrite($file,"$comma_separated"."\n");
}
fclose($file);
?>