PHP Problem
|
Author |
Message |
MaDc0w
need...steak....sauce.....
Posts: 255.3702 Threads: 22
Joined: 15th Apr 2007
Reputation: -6.35773
E-Pigs: 10.1397
|
PHP Problem
I need help fixing the following code.
partial code:
content of file.txt:
result of file2.txt:
If I echo the output to the active window I get the same results.
I also get the same results no matter how I try loading the data.
|
|
06/08/2008 07:22 AM |
|
MaDc0w
need...steak....sauce.....
Posts: 255.3702 Threads: 22
Joined: 15th Apr 2007
Reputation: -6.35773
E-Pigs: 10.1397
|
RE: PHP Problem
I fixed the problem myself. :P
Since I could not fix that bug/problem, I decided to take a different route.
I trimmed the file while creating file.txt.
Old code:
New code:
This of course is cleaner and the whole block of code in the
first post becomes unnecessary.
Still makes me wonder why it doesn't work, on my test server it runs fine!
Mythos tested it on his server and it also ran fine!
So? Anyone got a clue?
I figure it has to do with it running on an IIS server with
some bad/wrong/my badly configured php.ini..
You win some, you lose some..
Thanks for reading my rambling!
|
|
06/08/2008 10:28 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: PHP Problem
If I recall correctly, Windows breaks newlines with \r\n, so exploding on \n will keep all the \r's in place.
I wouldn't fopen() all the time during the loop (though if this is a personal script, shouldn't be an issue). You should also escape \ with \\.
(This post was last modified: 06/08/2008 05:41 PM by ZiNgA BuRgA.)
|
|
06/08/2008 05:39 PM |
|
MaDc0w
need...steak....sauce.....
Posts: 255.3702 Threads: 22
Joined: 15th Apr 2007
Reputation: -6.35773
E-Pigs: 10.1397
|
RE: PHP Problem
Well even though the script now works i did want to try your suggestions.
It's much faster without opening the file in a loop. :D
So if I wanted to use that piece of code i'd have to trim the \r's to stop what happens in file2.txt? I need to try that when I have time.
Now all I need is MyPlaza for MyBB 1.4 and I'm all set! ![Wis Wis](images/smilies/wis.gif)
Actually, You should separate the username formatting as it's own plugin. :D
* runs from ZB before he gets smacked.
|
|
06/08/2008 10:49 PM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: PHP Problem
MaDc0w Wrote:So if I wanted to use that piece of code i'd have to trim the \r's to stop what happens in file2.txt? I need to try that when I have time.
Probably, but I haven't looked through all the code.
MaDc0w Wrote:Now all I need is MyPlaza for MyBB 1.4 and I'm all set! ![Wis Wis](images/smilies/wis.gif)
Actually, You should separate the username formatting as it's own plugin. :D
O_o, I never knew you ran a board. Can I see it? :P
(This post was last modified: 06/08/2008 10:54 PM by ZiNgA BuRgA.)
|
|
06/08/2008 10:53 PM |
|
MaDc0w
need...steak....sauce.....
Posts: 255.3702 Threads: 22
Joined: 15th Apr 2007
Reputation: -6.35773
E-Pigs: 10.1397
|
RE: PHP Problem
I also noticed how picky php is to empty lines when coding. :)
And I cleaned all my paths too.
http://www.undergroundz.org
not much to see atm, all clean and new..
Just needs some content now!
|
|
08/08/2008 04:10 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
|
09/08/2008 11:26 PM |
|
User(s) browsing this thread: 1 Guest(s)