Re: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Matthew Vos
Do you have long lines? If not try this: $file = "error_log.txt"; if (($fp = fopen($file,'r+') !== 0) { // Increment the 1024 sufficiently to read enough data, fgets automatically stops at \n while ($line = fgets($fp,1024)) { if ($line != "") echo($line.""); } } Alternatively,

Re: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Kim Steinhaug
Attached is a little textfile on 4 lines, it will choke afte 1 line due to the "\n\n" problem. I use this loop to parse it : $file= "error_log.txt"; if($fp=fopen($file, "r+")) { while($line=trim(fgets($fp))) { echo $line . ""; } } -- Kim Steinhaug

Re: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Kim Steinhaug
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 "standalo

Re: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Eugene Lee
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 som

RE: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Jay Blanchard
[snip] 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, sinc

[PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Kim Steinhaug
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 s

RE: [PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Jay Blanchard
[snip] I found that the script accually breaks on this line : [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) VALUES (-1,"2003-07-14","TESTAMENT endelig til Norge!!!", "Spiller p Rock in - spesial treat f

[PHP] Re: Opening large file problem - fopen

2003-12-16 Thread Kim Steinhaug
I found that the script accually breaks on this line : [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) VALUES (-1,"2003-07-14","TESTAMENT endelig til Norge!!!", "Spiller p Rock in - spesial treat for the