|
Re: PHP Troubles
Your best bet with a parse error is to look at the line number it grumbles about, as that tells you which area of your script to look at. Without that information, readers here can only guess where to look in a big piece of code. However, I couldn't help but notice that the last else { block in the code posted is missing its } which is certainly an error ... goodness only knows if it's the only error though!
It's generally a good idea to write / test a program section by section. If you have a piece of code that works at 50 lines long which then fails when you extend it to 60 lines, you know to look in the 10 lines just added.
When faced with a bigger bit of code to sort out, another useful trick is to use /* through to */ style comments to take out chunks and see if that changes / removes he problem. Such clues, once again, help you find your needle in your haystack.
One final comment If you find yourself repeating something, there's probably a much easier way of doing it. Your code as written is going to be hard to maintain and consistently debug, and you if statements are well ... not nice code. In fact, I think you have some missing || operators in them - I just spotted that. You have, as far as I can see, 4 corrections to make there. Nice code (easily readable, code not duplicated with minor variation!) can come in your next program, though - you have to start somewhere!
|