Hello, Thanks for you reply. The first approach works, I succesfully imported 1.903.541 entries into my mySQL database, phew! Problem was that as mentioned I had to "massage" the data beforehand, which with TextPad didnt take to much time but again I love my scripts to be complete and be "standalone".
Back to the 2) option, I tried another approach, just to see how far the script woul accually go. There are ~2,1 million lines in the error_log so I would like to see a result for the $i in this range. But this script also chokes. $file = "error_log"; $handle = fopen ($file, "rb"); $contents = ""; do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents = $data; $temp = explode("\n",$contents); $i = $i + count($temp); if($i%1000==0) // Spit out every 1000 lines count echo $i . "<br>"; } while(true); fclose ($handle); echo $count; exit; Do you have an example, or link to a site discussing the issue, of buffering the data? -- Kim Steinhaug --------------------------------------------------------------- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --------------------------------------------------------------- "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: > : > : I found out that what the script accually does is choke on "\n\n", > : empty lines. I havnt found a way to solve this with the script, > : > : What I do now is use TextPad and just replace all occurencies > : of "\n\n" with "\n-\n" or something and it works all nice. But this > : is a bad way of doing it, since the script still doesnt accually work... > > You have two options: > > 1) massage your data beforehand so that your script works properly > > 2) buffer your input lines so that you process them only after you have > read a complete "entry", since one entry may span multiple lines in your > error_log. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php