View Single Post
Old 01-10-2011, 03:54 AM  
Kiopa_Matt
Confirmed User
 
Industry Role:
Join Date: Oct 2007
Posts: 1,448
Yep, but it's best to do it line-by-line, instead loading the entire file into memory at once. Create mySQL table,then for example:

Code:
$file = fopen('myfile.txt', 'r');
while ($line = fgets($file)) { 
     // Parse data, and insert into mySQL table
}
fclose($file);
That way you're only loading one line into memory each time, instead of the entire 20MB of data.
__________________
xMarkPro -- Ultimate Blog Network Management
Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!
Kiopa_Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote