mysql - In CSV file \t (tab) is not accepting as column delimiter with php -


well, file i'm working save mysql query result .csv format. it's return data when view csv file it's showing ? mark in each row. it's because it's not accepting \t tab character column delimiter seperate each column value.

how use t character in csv , how show result in each column column not overwrite each column value column ?

what i'm expecting in csv file :

-------------------------- column 1        column 2 ------------------------- result 1       result 2 result 1       result 2 result 1       result 2 result 1       result 2  

but it's showing: http://propertyjungle.com.au/correct-view.gif

csv.php file

?php $filename = 'text.csv'; header('content-type: application/csv'); header('content-disposition: attachment; filename='.$filename);  $host=""; $uname=""; $pass=""; $database = "";  $connection=mysql_connect($host,$uname,$pass);  echo mysql_error();  //or die("database connection failed"); $selectdb=mysql_select_db($database) or die("database not selected");   $result=mysql_select_db($database) or die("database cannot selected <br>");  $sqlagentdetails = "select * users company_name != ''"; $rowresult = mysql_query($sqlagentdetails);   echo "column 1"; echo "\t"; echo "column 2"; echo "\n";   while($row = mysql_fetch_array($rowresult, mysql_assoc)) {     $myquery =  mysql_query( /* query goes here...*/ );      while($row = mysql_fetch_array($myquery)){        $postcode = "{$row['postcode']}";       $paddress = "{$row['paddress']}";  echo "$emailagent"; echo "\t"; echo "$paddress"; echo "\n";      } } ?> 

i'm not sure whether can directly export data .csv or not code working fine if replace .xls . can convert .csv . hope way works

$filename = 'text.xls'; 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -