Somebody slap me.

I spent most of yesterday working on a nifty little php script for work…

When I was testing it, I was running into all sorts of odd behavior and I got tired of trying to de-bug it. I put it up on my website so I could work on it over the weekend.

I just spent the last hour or so breaking the script from a single php file into 6. I thought my scheme for having the different steps the script goes through as functions controled by a variable called $stage was somehow flawed, since in some cases I was making the script pass arguments back to itself via the URL. Or something – I wasn’t exactly sure what was wrong. It was buggy and needed to be fixed.

THEN I see that I’m using “=” instead of “==” to check what “stage” I’m on in the master control structure that determines which function to do.

OF COURSE the statement

if (stage = 1) {
doStepOne;
} elseif (stage = 2) {
doStepTwo;

is going to always have me doing step 1…

GAH! I r stupid.

Now the question is, do I go back to my single php page design, or keep working on the multi-page one?

Edited on Oct 27th 2002, 07:49 by Hooloovoo

Edited on Nov 22nd 2002, 17:56 by Hooloovoo

Published by

Robert

Robert Belknap has been writing online sporadically since 2001. See the colophon for more details.

3 thoughts on “Somebody slap me.”

  1. I used to do that quite a lot, when I was coding on my own. After I started working on other systems where other people were having to debug my code, I got caught once with it by mistake, putting all of us through 3 hours of heavy debugging to track it down. Was so humiliated I make sure now I never do it.

  2. It’s stupid crap like that that still gets me caught up from time to time. At least it’s not as bad as the first programming class I took. My lab partner and I were BOTH notorius for dropping semi-colons…

    Anyway, my multi-page script seems to be working pretty well, and is a bit easier to debug. I’m going to stick with it for now, as I still have a couple of big pieces of functionality to write. When I’m done, (if I still have time – that is,) I may look at putting it all back into my single page design. I want to see if the idea was/is sound.

  3. It’s just down to practice and experience. Now writing C/C++ code is so second nature to me that I can write code with little effort to the syntactic details, and all effort instead goes into algorithmic design.

    Scary when you realise I can code much faster than I can touch-type… šŸ™‚

Leave a Reply

Your email address will not be published.