Help for this page

Select Code to Download


  1. or download this
    my $query = "SELECT location FROM demstock2 WHERE ds_id=$main";
    my $sth   = $db->prepare($query);
    $sth->execute or print "Can't execute <pre>$query</pre>: " . $db->errs
    +tr . "<br>\n";
    
  2. or download this
    my $query = "SELECT location FROM demstock2 WHERE ds_id=?";
    my $sth   = $db->prepare($query);
    $sth->execute( $main ) or print "Can't execute <pre>$query</pre>: " . 
    +$db->errstr . "<br>\n";
    
  3. or download this
    my %actions = { 'BOND'=>\&do_bond,
                    'SHARE'=>\&do_share }
    ...
    } else {
       print "Action is not defined.";
    }
    
  4. or download this
    sub do_bond {
       get LOCATION;
    ...
          update & insert or return;
       return 1; # if you got here, everything's fine
    }
    
  5. or download this
    sub do_bond {
       get LOCATION;
    ...
          update & insert or { set error; next; }
       return 1; # if you got here, everything's fine
    }