undefined function eror

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

undefined function eror

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

PHP 5 function.

The PEAR Compat library has it.
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

Post 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!
Post Reply