Binding output parameters in PERL DBI and MySQL

my $dbh= DBI->connect_cached('DBI:mysql: test','username','password',{private_connection_key1 =>'connX'})
my $sth= prepare('SELECT id, name FROM t1') ;
$sth->execute();
my ($id, $name) ;
$sth->bind_col(1, \$id);
$sth->bind_col(2, \$name);
print ($id);

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.