Hello,
I would greatly appreciate help with the following!
I need a PHP function that can extract data from a plain .txt file (separated into rows and columns) into individual variables or arrays.
For reference, see this file: http://www.ndbc.noaa.gov/data/realtime2/41002.txt
For example, assign the data value in row 3 column 4 as $WSPD['4']
Is there any easy way to do this? Ultimately, I'd like to extract the data from files similar to the above and insert it into a MySQL database.
Any help or hints would be greatly appreciated!!!!!
-Dustin
Extract data from .txt file
Moderator: General Moderators
-
cavemaneca
- Forum Commoner
- Posts: 59
- Joined: Sat Dec 13, 2008 2:16 am
Re: Extract data from .txt file
Look At This
Just read each line into an variable, explode into an array, store to database, lather, rinse, repeat.
Just read each line into an variable, explode into an array, store to database, lather, rinse, repeat.
-
dtwebdesign
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 15, 2008 9:24 pm
Re: Extract data from .txt file
Brilliant. I new it was easy.
It's funny and scary to think actually, that a huge website is based entirely on a workaround to not being able to solve this simple problem which you just helped me solve in I think less than an hour.
Thank you!
It's funny and scary to think actually, that a huge website is based entirely on a workaround to not being able to solve this simple problem which you just helped me solve in I think less than an hour.
Thank you!