dpmott has asked for the wisdom of the Perl Monks concerning the following question:
What I have there works, but I really wanted to use a placeholder for the where clause (i.e. 'where id=?'). (The code that I have commented out would implement this). However, this doesn't work -- it writes the ID to the title field, the title to the description, the description to the eventdate field, the eventdate to the persistent field, and throws out the value provided for the persistent field.elsif ( $action eq 'Update' ) { # update the event my @bind = ( $q->param( 'title' ) || '', $q->param( 'description' ) || '', $q->param( 'eventdate' ) || '', $q->param( 'persistent' ) || '0', # $id, ); # Hmmm, there appears to be a bug in here somewhere... # my $sth = $dbh->prepare( "UPDATE tblEvents SET title=?,descri +ption=?,eventdate=?,persistent=? where id=?" ) my $sth = $dbh->prepare( "UPDATE tblEvents SET title=?,descri +ption=?,eventdate=?,persistent=? where id=$id" ) or die "Cannot prepare: " . $dbh->errstr(); $sth->execute(@bind) or die "Cannot execute: " . $sth->errstr +(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Frustration with DBD::CSV and UPDATE
by jZed (Prior) on Nov 16, 2005 at 02:14 UTC | |
by dpmott (Scribe) on Nov 16, 2005 at 15:33 UTC |