
November 13th, 2012, 02:08 AM
|
|
Registered User
|
|
Join Date: Oct 2010
Posts: 18
Time spent in forums: 5 h 43 m 39 sec
Reputation Power: 0
|
|
|
PHP5 - Parse EDI with PHP/MySql
Hi! I have a 40K line EDI (fixed length) file that I must parse into a csv. If you know edi you know that each element has its own fixed length.
Im new to parsing EDI and just need a bit of help. My first thought is to set up a table that will hold the element lengths either as an array or as such
Code:
Table EDIInfo
EDI_ID | EDI_ElemLengths
1 | 3,22,7s2,30,30,22
2 | 30,5s2,9s2,3,1,23
** the s in the array above denotes a decimal ofter the second place from right.
So once I get this data into the db, Im not sure how to pull it out to apply it to the file that I have located on my server. The file is extensionless at this point, its a simple text file. Id like to parse it into a new file XXXX.csv in the same directly.
Any links to tuts or any help/direction would be greatly appreciated.
|