in reply to What is wrong with this DB insert, place holder problem?
Also note that your error handling is incorrect.
Your code:
$sth = $dbh->prepare($statement) or die "Couldn't prepare the query +: $sth->errstr"; my $rv = $sth->execute($filename,$to,$from,$comments,$uldate,$expdate) + or die "Couldn't execute query: $dbh->errstr";
What will happen when $dbh->prepare fails? then $sth will be undefined, and then you go on to the 'or', which calls $sth->errstr. Do you really think this make sense? :)
It would be better to replace $sth->errstr with $dbh->errstr in your first statement, and in your second $sth->errstr would be better...
Update: also why don't you put $expdate = $uldate + 86400 * $expire (after the $expire !~ m/...?) instead of those three if-statements
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is wrong with this DB insert, place holder problem?
by awohld (Hermit) on May 15, 2005 at 02:55 UTC |