Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Help with uni project: DBI errors in CGI script

by RazorbladeBidet (Friar)
on Mar 16, 2005 at 20:06 UTC ( [id://440124]=note: print w/replies, xml ) Need Help??


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

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
  • Comment on Re^3: Help with uni project: DBI errors in CGI script

Replies are listed 'Best First'.
Re^4: Help with uni project: DBI errors in CGI script
by ginda (Initiate) on Mar 16, 2005 at 20:29 UTC
    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
Re^4: Help with uni project: DBI errors in CGI script
by Anonymous Monk on Mar 16, 2005 at 20:23 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://440124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-19 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found