in reply to Dates and SQL
I've got a couple of suggestions for you:
Errors may be caught in $dbh->errstrmy $cur_time = time2str("%c", time) ; $dbh->do("UPDATE Schedules SET Date = ? WHERE ID = ?", undef, $cur_time, $id) ;
This may be prefered if you're going to be executing that $sth in a few places. Once $sth is prepared, it may be executed with different values multiple times.my $sth = $dbh->prepare("UPDATE Schedules SET Date = ? WHERE ID = ?"); my $cur_time = time2str("%c", time) ; $sth->execute($cur_time, $id) ;
Hope that helps =)
Update: BTW, I don't know what $id looks like, but if it's non-numeric, that's probably what UPDATE is barfing on: Needs escaping... but placeholders take care of that stuff =)
-Ducky
|
---|