Here is my code which generates the "cavendish.txt' file i have attached. The sample file which this is all supposed to look like is called 'sample.txt'.
The only thing I see different is at the end of the file i have some of those square box characters (i can't copy one in here)... don't know how to get rid of them...
Advice appreciated.
$filename="cavendish.txt";
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=$filename");
echo "FIRSTNAME\tLASTNAME\tSTREET\tCITY\tSTATE\tCOUNTRY\tPOSTALCODE\tLANGUAGE\tPUBLICATIONS\tSOURCECODE\r\n";
$sql = "SELECT * FROM tracking WHERE call_centre=0";
include("dbase_info.inc");
$link_id = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$result=mysql_query($sql) or die("Unable to execute select query - $sql");
while($line=mysql_fetch_array($result)) {
echo "$line[first]\t$line[last]\t$line[address]\t$line[city]\t$line[province]\tCA\t$line[postal]\tE\tCB\twww.peiplay.com/cavendish\r\n";
}
mysql_close($link_id);