:Please forgive me for having posted this more than once.  I am trying to
reword it here to make it more plain.
---------------
I have a fixed length text file I'm trying to import and send into MySQL.

A record line is about 1600 characters long and includes many blank spaces.

I thought by using file('FILENAME.TXT') I would have a nice neat array of
each record in the file based on each line being a record.
Here's an example txt file:

ABCDEFG HIJ     KLMNOP
YASFSEFAFSAFSDFFDS
(notice the 4 spaces after J and before K on line 1 of the above text file)

So, I went on breaking up the line into fields by doing this:

$ra=$recordArray=file('FILENAME.TXT');

for($index=0;$index<count($ra);$index++) {
$FIELD_1[]=substr($ra[$index],0,18);
$FIELD_2[]=substr($ra[$index],18,19);
$FIELD_3[]=substr($ra[$index],19,20);
}

I expected that to give me 3 fields on line 1 that would have looked like
this:

FIELD 1 = ABCDEFG HIJ    KLM
FIELD 2 = N
FIELD 3 = OP

Instead it gave me:

FIELD 1 = ABCDEFG HIJ KLMOP
FIELD 2 =
FIELD 3 =

because it stripped out the empty spaces along the way.

Can you tell me how I might prevent that from happening?

Thanks very much,

Jay Lepore
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to