hey there, ok using the following script to retrieve the answers off my database for a questionnaire so the user can view the answers.
// query database for answers not yet taken
$result = mysql_query("SELECT * FROM tbl_questionnaire");
// generate file and make writeable
$file = fopen("upload/questionnaire.csv", "wb");
// loop results
while($row = mysql_fetch_row($result))
{
// data gathering
$line = implode(",", $row) ."\n";
// write data to file
fwrite($file, $line);
// mark answer as taken
$sql = mysql_query("UPDATE tbl_questionnaire SET fld_taken='y'");
}
// close file
fclose($file);
Now, I have some textarea boxes so users can type as much as they want. Problem is, when it comes to writing the CSV file it puts different lines in different columns. It doesn't put them all in the same column.
Any ideas why, it's driving me nuts.
Cheers,
Chris