Clara Agius
Clara Agius

Reputation: 11

PHP fgetcsv error - How can I arrange it?

I am getting the following error:

"Notice: fgetcsv() [function.fgetcsv]: delimiter must be a single character" in my browser

My PHP Code is as follows - can someone rearrange it please?

$fh = fopen('notes.txt', 'r') or die('Unable to open notes.txt');
while(($line = fgetcsv($fh, 0, '||')) !== FALSE)
   if ($line[0] == $name) {
       echo <<<EOL

My color is $line[2]
EOL;
       break; // if there's only ever one '5678' line in the, get out now.
   }

fclose($fh);

Upvotes: 0

Views: 2313

Answers (2)

semper
semper

Reputation: 36

In simple words you are using tow characers "||" when you can only one like comma ",". Read the documentation.

Upvotes: 0

ncremins
ncremins

Reputation: 9200

from the fgetcsv documentation, your delimiter can only be one character in length. for future reference though when asking a question to do with files being able to see the data (or a sample of data) is invaluable

Upvotes: 1

Related Questions