Hi,
I am new to PHP and I am lookig for more information on the formating strings for example \n\r
I was trying to find them on google to read more about them but not sure what to search for.
Could somone please tell me where I can find some more information on this.
or maybe yo ucan help me with my issue.
I created thsi function and I want to clean up a comment field from ? and ,s but I want it to continue the line.
it is creating a new line when I try to convert it to an Excel .csv file.
Thanks
Here is my code:
<center><h1><img border="0" src="banner.gif" width="805" height="70"></h1>
<h1>Survey Results</h1></center>
<?php
function cleancomm($comm)
{
$comm1 = str_replace('?', ' ', $comm);
$comm2 = str_replace(',', ' ', $comm1);
return $comm2;
}
require 'config.php';
require 'opendb.php';
$fp = fopen('file.csv','wa');
$q = 'select * from survey';
$query = mysql_query($q);
while ($row = mysql_fetch_array($query)) {
$nextline = $row[0] . ',' . $row[1] . ',' . $row[2] . $row[3] . ',' . $row[4] . ',' . $row[5] . ',' . $row[6] . ',' . $row[7] . ',' .
$row[8] . ',' . $row[9] . ',' . $row[10] . ',' . $row[11] . ','. $row[12] .',' . cleancomm($row[13]) . ',' . cleancomm($row[14]) . "\r\n";
fwrite($fp,$nextline);
}
fclose($fp);
?>