Parse CSV with PHP!! ......???

Discussion in 'PHP' started by gemini181, Oct 20, 2008.

  1. #1
    This is a PHP class which earned several enthusiastic comments on the Google code site (I'm sure it might help someone) :)

    parsecsv-for-php

    I'm slowly learning "the hard stuff", and need help with a simple question:

    > If the csv file has only one entry (a live update of a stock index, for example)
    and...

    1) I need to use php to read the file ('test.csv')
    2) Turn the one number into a (ready to use) php variable

    I've looked at tutorials which build arrays, and that's overkill. How can I (import and) turn the one (imported) number into a variable?
    If you have a moment, please, provide a 'detailed' code chunk, so I can learn from it.

    Thank you very much.
     
    gemini181, Oct 20, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    functions that you need are fopen, fread(s), explode check PHP.net for details!
     
    EricBruggema, Oct 20, 2008 IP
  3. gemini181

    gemini181 Well-Known Member

    Messages:
    2,883
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    155
    #3
    fread or fgetcsv?
    explode or fclose?

    Thanks, for any further details.
     
    gemini181, Oct 20, 2008 IP