Tuesday, January 09, 2007

Code snippets shall appear here

I've been doing many a coding session lately and I've learned an awful lot with php so in an aide to helping me in the future when I come up with a familiar problem I have decided to add snippets of php code here so I can come back and learn from myself...

today I had the error:
syntax error, unexpected $end in /blahblah
it was relating to php code in a webpage, turns out I forgot to close a while loop with a } curly bracket.

I wrote some code to keep a log of stats on one of my pages because the original 3rd party stats code I was using suddenly stopped working. I spent a while coming up with this code



remind myself for the future that if I am checking two statements in a while loop so it stops on and end of file OR flag to use && and not ||. if I use OR then the loop will execute if either is true. To stop the loop if any of the statements turn false I must use AND (&&). doh!

I wrote the code, got it working and put it in the page in place of the original 3rd party code and it still wouldn't show up!

further investigation found it to be when I had used an iframe> command, if you don't close it with /iframe> then html table code below it wont be displayed.

So I never needed to write any code! 'twas fun tho

No comments:

Post a Comment