Re: extracting data from text file
| From: | Pushkar Pradhan | Date: | Mon, 01 Jul 2002 21:26:36 +0000 |
| Subject: | Re: extracting data from text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104785@lists.php.net to get a copy of this message | ||
Just use file(), this is most appropriate for reading file line by line.
http://www.php.net/manual/en/function.file.php
>
> On Monday, July 1, 2002, at 05:17 PM, rdkurth@starband.net wrote:
>
> > I have trend this but it does not work properly
> >
> > $fp = @fopen(file.txt,"r");
> > $line = explode("\n",$fp);
> > $valueC = "$line[0]";
> > $valueST = "$line[1]";
> > @fclose($fp);
>
> What error messages are you getting? I imagine that since you've
> suppressed the errors with the "@", you will need to remove this to give
> us any useful information.
>
> One other thing, has your file been saved with the appropriate line
> breaks for your server? In some cases, a file may have DOS/Windows or
> Macintosh line breaks which are not \n but rather \r\n and \r
> respectively IIRC.
>
>
> Erik
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> pricee@hhbrown.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
-Pushkar S. Pradhan