sub updateFlyer { my $contentType = shift; use DBI qw(:sql_types); my ( $sql, $sth, $dbh, $mimeType, $contentImage ); # Database connection $dbh = DBI->connect("dbi:ODBC:something", 'something', 'somepass', {RaiseError => 1}) or die DBI->errstr; # Debug stuff if (1) { DBI->trace(2, "trace.txt"); } ( $mimeType, $contentImage ) = uploadImage( $query ); $sql = "UPDATE interface..CustomContent " . "SET contentImage = ?," . " contentImageType = ? ". "WHERE contentType = ?"; $sth = $dbh->prepare( $sql ); # Gotta bind the image $sth->bind_param( 1, $contentImage, SQL_LONGVARBINARY ); $sth->execute ( $contentImage, $mimeType, $contentType ); $sth->finish; $dbh->disconnect; }