Results 1 to 2 of 2

Thread: fgetcsv won't give me my array

  1. #1
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default fgetcsv won't give me my array

    I trying to read a file so I can put it into my database. The problem is that the function fgetcsv won't separate it into an array, but just as a single array[0]. What am i missing here?

    <?php
    $handle = fopen("input.txt", "r");
    while (($data = fgetcsv($handle, 1000, "*")) !== FALSE) {
    print $data[0];
    print $data[1];
    }
    fclose($handle);
    ?>

    The input file is a number count to ten separated by "*". Odd thing it sometimes works once.

  2. #2
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    Never mind I figured it out. Apparently I'm not allowed to use returns after my separator

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •