daveh71 has asked for the wisdom of the Perl Monks concerning the following question:

I have code that for the most part works. However I'll add a few very basic lines (like an elsif), and the script will halt. The strange thing is when i go through my browser it halts the script...when i run the same thing command line, most of the time it doesn't freeze. sorry i'm so vague, but I really don't have any idea what specifics could be causing my problem. Are there any pitfalls to cgi that I could be running into? david

Replies are listed 'Best First'.
Re: help! cgi dbi
by ok (Beadle) on Apr 17, 2001 at 02:20 UTC
    Post some code! :)
      i don't know where to begin posting code. Here's one snippit
      if ($D::table == /client/i) { $sth_clients = $dbh->prepare_cached("select * from client" +); $sth_clients -> execute; while (@info = $sth_clients->fetchrow_array) { #make a has +h table...yahoo!!! $clients{$info[0]} = $info[1]; } $sth_clients ->finish; } #getlist of projects that are active $sth_project = $dbh->prepare_cached("select * from project + where active=1"); $sth_project -> execute; while (@info = $sth_project->fetchrow_array) { #make a has +h table...yahoo!!! $projectList{$info[0]} = $info[1]; } $sth_project ->finish; &DisconnectDB; print "<FONT face='Arial' size=2><b>ADD $table ";
      keeping everything else the same, if I put the second halfin an else block(below) the script locksup in the browser.
      if ($D::table == /client/i) { $sth_clients = $dbh->prepare_cached("select * from client" +); $sth_clients -> execute; while (@info = $sth_clients->fetchrow_array) { #make a has +h table...yahoo!!! $clients{$info[0]} = $info[1]; } $sth_clients ->finish; } else { #getlist of projects that are active $sth_project = $dbh->prepare_cached("select * from project + where active=1"); $sth_project -> execute; while (@info = $sth_project->fetchrow_array) { #make a has +h table...yahoo!!! $projectList{$info[0]} = $info[1]; } $sth_project ->finish; } &DisconnectDB; print "<FONT face='Arial' size=2><b>ADD $table ";
      thanks
        if ($D::table == /client/i) {
        You probably mean:
        if ($D::table =~ /client/i) {
        Also, make sure you are using -w and use strict; as that might help you find more errors.
        Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain