1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

the while loop to repeat

Discussion in 'PHP' started by Aven, Mar 8, 2010.

  1. #1
    Hello,

    I am extremely new to PHP and I have a question that I think is easy to code, but I've searched and cannot get the right answer.

    I basically have a text file that looks like the following:

    Name,Last Name, Date, Email, comment_name, comment, comment_name, comment, ... , ... , ... ,...

    Now I want to execute all of that but I want to keep repeating from comment_name till there is nothing left after the "," this is because I am allowing many comments with as many names as they want...

    I know that I have to use the while() loop to keep it going and to stop but how?

    thank you
     
    Aven, Mar 8, 2010 IP
  2. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #2
    twistedspikes, Mar 8, 2010 IP
  3. Aven

    Aven Peon

    Messages:
    335
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    twistedspikes, that's what I want to do but the fopen, or fget won't work because it will read the entire file.. i just need it a to constantly repeat a single line
     
    Aven, Mar 8, 2010 IP
  4. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Yeah, you need to read the whole file into the PHP and put it in an array. After that you can use a while loop to go through it - as it shows in that article.
     
    twistedspikes, Mar 8, 2010 IP