Help for this page

Select Code to Download


  1. or download this
    ... or die "Couldn't execute query: ".$dbh->errstr;
    
  2. or download this
    $statement = "SELECT city FROM database WHERE state='$FORM{state}'";
    
  3. or download this
    $statement = "SELECT city FROM database WHERE state=?";
    
    $sth = $dbh->prepare($statement) or die "Couldn't prepare the query: "
    +.$sth->errstr;
    
    $rv = $sth->execute($FORM{state}) or die "Couldn't execute query: ".$d
    +bh->errstr;
    
  4. or download this
    # inside the html <table>
    foreach my $row ($sth->fetchall_arrayref) {
       my $state = $row->[0];
       print "... some html or other based on $state...";
    }
    
  5. or download this
    ------------
    :Wq
    Not an editor command: Wq