im having problems exporting to csv
$csv_output .= $result['domain'] . "\n" . $result['whois'] . "\n" . $result['dig'] . "\t" . ;
Theres something wrong with this syntax ?
Please help
I need the csv file to each of the results to be in a seperate column and then for it to break to the next line
csv output
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: csv output
What does the C in CSV stand for? I don't see any of those. You also have an extraneous . near the end of your string.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: csv output
You know this is the second post in the past what, 3 days, where someone has left the C outta the CSV files. Interesting....
Re: csv output
this is now working had help from a another programmer
$csv_output = "Domain\tWhois\tdig\tavailability\t\n";
$filename = "multi_whois.xls";
foreach ($results as $result){
$whois = str_replace('"', "'", $result['whois']);
$return = str_replace("1", "UNAVAILABLE", $result['availability']).
// $return = $availability
$csv_output .= $result['domain'] . "\t" . '"'. $whois .'"'. "\t" . '"' . $result['dig'] . '"' . "\t" . $return . '"' ."\n";
}
WAS told not to use commas as the data from the whois statment can return commas and then this will break when its exported to csv!
$csv_output = "Domain\tWhois\tdig\tavailability\t\n";
$filename = "multi_whois.xls";
foreach ($results as $result){
$whois = str_replace('"', "'", $result['whois']);
$return = str_replace("1", "UNAVAILABLE", $result['availability']).
// $return = $availability
$csv_output .= $result['domain'] . "\t" . '"'. $whois .'"'. "\t" . '"' . $result['dig'] . '"' . "\t" . $return . '"' ."\n";
}
WAS told not to use commas as the data from the whois statment can return commas and then this will break when its exported to csv!
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: csv output
Then that is tab delimited not comma delimited. If you quote text in a CSV file then the commas are not a problem:
[text]"column 1 with a , in it","column 2, with 2 , s in it","etc, etc, etc..."[/text]
[text]"column 1 with a , in it","column 2, with 2 , s in it","etc, etc, etc..."[/text]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.