Newbie Question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a text file with 6 colums of data. I need to read it and in
colums 2 and 3 do something to the data. First of all I can read the
file (all of it) or some of it ie one line


$myFile = "orbit.txt";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
echo $theData;


and this is ok. How to get to the data in colum 2 and 3 of this thing
called $theData?

Also I need to put a loop around it for i = 0 to end of file (do
as in basic.



Re: Newbie Question


Quoted text here. Click to load it

It all depends on how your file is formatted/how these elusive 'columns'=

are defined.
Probably csv, then this is something you want:

$myFile = 'file.csv';
$fh = fopen($myFile);
while($row = fgetcsv($fh)){
    echo "
        value 2:
        value 3: ":
-- =

Rik Wasmus

Site Timeline