Question

My code looks like this .. the o/p is a csv file with 4 values in ONE cell and so on in the FIRST column alone

Better versions of this code please . ASAP

foreach ($xml->xyz as $xyz) {  
$f = fopen('blahblahblah.csv', 'a') or die("can't open file");  
fputcsv($f, get_object_vars($lis),';','"');  
Was it helpful?

Solution

$f = fopen('blahblahblah.csv', 'a') or die("can't open file");    
foreach ($xml->xyz as $xyz) fputcsv($f, get_object_vars($lis),';','"');
fclose($f);

It should be fine like this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top