in reply to Re: Help with uni project: DBI errors in CGI script
in thread Help with uni project: DBI errors in CGI script

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^2: Help with uni project: DBI errors in CGI script

Replies are listed 'Best First'.
Re^3: Help with uni project: DBI errors in CGI script
by RazorbladeBidet (Friar) on Mar 16, 2005 at 20:06 UTC
    If you add the pragma "use strict" to the top of your code, you will see why. You've not declared the @row variable. Therefore, nothing will be printed. You probably meant to have @results there. "use strict" can help you with those kinds of things (as can "use warnings")
    --------------
    It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs
      I have added the strict pragma, then ran script and it did mention the two arrays i then declared them and now no errors, now it just doesnt display anything but a blank web page.
      When i check the source of the page i get

      <HTML>
      <BODY>
      </BODY>
      </HTML>
        You're not listening. You're not PUTTING anything in the @row array, you're only putting things in the @results array. You're printing an EMPTY array.
        _____________________________________________________
        Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
        How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
      I used strict and it did give me the message regarding them two array variables, i declared them at start of code then ran teh code and now no errors but still not data be displayed in browser?
        How are you expecting any content to get into the array @row? There is nothing in your code that puts anything in there.

        Declaring all your variables at the start of your code is a very self destructive habit.

        Declare all your variables as lexically scoped in the smallest applicable lexical scope unless you have a positive reason to do otherwise. (Note: this has nothing specifically to do with Perl - it applies in all programming languages).

        If you followed this advice you would have been much less likely to have made the mistake.