Arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
misfitxnet
Forum Newbie
Posts: 14
Joined: Mon May 11, 2009 8:40 am

Arrays

Post by misfitxnet »

I am trying to manipulate an array from a output text file.
It is from a form, and so far it outputs onto only one line.

Here is the code im using

Code: Select all

 
<?php
             
               $commenttext=file_get_contents("d:\hshome\c239198\local54memberforum.com\info.txt");
               list($name, $comment) = split("\t", $commenttext);
               while (list($name, comment) = split("\t", $commenttext);
        echo "<tr>". 
            "<td>$name</td>\n"."</tr>\n"."<tr>"."<td>$comment</td>\n"."</tr>\n";
 
 
               
?>
 
This will only make the first two elements into an array, $name and $comment, but ignores the rest.
Is there anyway to make new lines in the output, or include the rest of the output and not only the first two elements?
Last edited by Benjamin on Tue May 12, 2009 10:16 pm, edited 1 time in total.
Reason: Added [code=php] tags.
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: Arrays

Post by Griven »

I don't know about formatting your output, but I did notice "comment" is a literal rather than a variable in your LIST construct.
Post Reply