File reading question. URGENT. and 5$ prize.

Discussion in 'PHP' started by deviant, Aug 9, 2008.

  1. #1
    Hello,I Have a php script question. I will pay 5$ to user who post the solution firstly. Please post the solution and PM me your paypal address.

    I have a .txt wile with some text datas on it.

    Datas are listed in the text as;

    Nockin:JJKEL
    Nursan:OLZK
    Besat:JKANW
    Sucan:QQOW

    I want to export them and list to .html page

    Name Nockin, Group JJKEL
    Name Nursan, Group OLZK
    Name Besat, Group JKANW
    Name Sucan, Group QQOW

    Waiting for your answer. thank you
     
    deviant, Aug 9, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php
    
    $lines = file('data.txt');
    
    foreach ($lines AS $line)
    {
        list($name, $group) = explode(':', trim($line));
        echo "Name {$name}, Group {$group}<br />\n";
    }
    
    ?>
    
    PHP:
     
    nico_swd, Aug 9, 2008 IP
  3. deviant

    deviant Peon

    Messages:
    58
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OH. How fast.. You are qualified for the prize. Want to take it?
     
    deviant, Aug 9, 2008 IP
  4. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    WoW ! just 2 minutes ! perfect nico ! :D
     
    James.Blant, Aug 9, 2008 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Lol, I don't charge for 4 lines of code, it's okay.
     
    nico_swd, Aug 9, 2008 IP
  6. deviant

    deviant Peon

    Messages:
    58
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thank you.
     
    deviant, Aug 9, 2008 IP