in reply to DBI bind_param problems
sub load { my $class = shift; my $id = shift; my $dbh = Some::Class->get_dbh(); my $sth = $dbh->prepare(<<"ENDSQL"); SELECT field1, field2 FROM table WHERE id = ? ENDSQL my ($field1, $field2); eval { # need to figure out why this bind_param isnt working $sth->bind_param(1, $id); $sth->execute($id); # ? is a placeholder, you have to supply + execute with the var :) $sth->bind_col(1, \$field1); $sth->bind_col(2, \$field2); };
|
|---|