programming-examples/perl/Database/do() method prepares and executes nonselect, nonrepeating statements in one step.pl

7 lines
247 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#$rows_affected = $dbh->do("UPDATE your_table SET foo = foo + 1");
use DBI;
my $dbh= DBI->connect("DBI:mysql:host=localhost;user=root,password=;database=sample_db");
$dbh->do("INSERT INTO employee(name)VALUES('A')");
my $dbh->disconnect();