Page 1 of 1

undefined function eror

Posted: Sun Jan 21, 2007 8:07 am
by speedy33417
I'm messing around with csv file output. I ran an example I found on php.net

Code: Select all

<?php

$list = array (
   'aaa,bbb,ccc,dddd',
   '123,456,789',
   '"aaa","bbb"'
);

$fp = fopen('file.csv', 'w');

foreach ($list as $line) {
   fputcsv($fp, split(',', $line));
}

fclose($fp);
?>
But I get this error message:
Fatal error: Call to undefined function: fputcsv() in /home/content/f/l/h/flhome/html/promediadesign/fputcsv.php on line 12

Is it because my hosting company doesn't support it or is it a problem with the code?

Thanks.

Posted: Sun Jan 21, 2007 8:15 am
by feyd
PHP 5 function.

The PEAR Compat library has it.

Posted: Sun Jan 21, 2007 9:14 am
by speedy33417
Thanks feyd.

Gave godaddy a call and apperently I just need to use extension php5 and it utilizes php5 version. Works like a charm!