MySQL and DBI using binding

my $dbh= DBI->connect_cached('DBI:mysql: test','username','password',{private_connection_key1 =>'connX'})
$sth= $dbh->prepare( "insert into testtable values (?, ?) ")
or die " ERROR in prepare: " . $dbh->errstr . "\n";
my $rv= $sth->execute( 1, 'first' ) ;
print "rows affected $rv\n" ;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.