[PHP] ASP guts needs help.

2004-09-22 Thread LW Ellis
I'm new to php, but am familar with ASP.
I have this code to open and read a text file.
What I need is to take out the 'while' and present the data one line at a 
time.
I read up on fgetcsv, but we will be using one text file per record.
I just need to format how it is displayed.

Under fgetcvs there was some code to display records $data[0] and 
1,2,3,4,etc.

Can someone please point me in the right direction?
?php
   if (!($fp = fopen(test.txt, r)))
   exit(Unable to open the input file.);
   while (!feof($fp))
   {
   $buffer = fgets($fp, 1024);
   print $bufferbr\n;
   }
   fclose($fp);
?
Thanx in advance.
Later,
Leon 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Solved [PHP] ASP guts needs help.

2004-09-22 Thread LW Ellis
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and you 
find the solution.

Thanx anyways
Leon 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Appended [PHP] Solved [PHP] ASP guy needs help.

2004-09-22 Thread LW Ellis

LW Ellis wrote:
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and you 
find the solution.
You should post back with a solution (append SOLVED to your subject) so 
that it becomes part of the thread (and archived). This way, next time 
someone else has a similar issue, they can search the archives for the 
post and find the answer.

Not that many people search the archives, but hey -- here's hopin :)
My answer I'm sure there are others...
?php
   if (!($fp = fopen(test.txt, r)))
   exit(Unable to open the input file.);
   while (!feof($fp))
  {
  $buffer[] = fgets($fp, 1024);
}
   fclose($fp);
?
// change the [0] to 1,2,3,4,...for each line of the text file you want to 
display.
? echo $buffer[0]?

Leon
PS No I didn't want to while it. 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php