PHP and CSV

Discussion in 'PHP' started by Gainax, Jun 9, 2008.

  1. #1
    Hi

    I have a csv with 17 columns.

    I'm only interested in 2 columns though, one is a 'TotalTime' column and the other is a MobileNumber(will be used to send an sms at a later time)

    What I'm looking to do, is loop through each row and append the time to pre-defined string, such as:

    For testing, I would like it to be outputted, in html to the screen (so i know it's working)

    Any ideas how I could do this?
     
    Gainax, Jun 9, 2008 IP
  2. Edynas

    Edynas Peon

    Messages:
    796
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    there is a function in php that might be handy http://nl.php.net/fgetcsv
    I never read directly from a csv file. I always parse it into a mysql database and take it from there.
     
    Edynas, Jun 9, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    or you use read to read all lines and use explode(",", $buffer) to read all items from a line and then view the data by echo $exBuffer[col number]
     
    EricBruggema, Jun 10, 2008 IP