programming-examples/perl/Database/Preparing a Statement Handle and Fetching Results.pl

8 lines
250 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use DBI;
$db=DBI->connect('DBI:mysql:sample_db;user=root;password=');
$sth=$db->prepare("SELECT * FROM employee") or die "Can't prepare sql statement" . DBI->errstr;
$sth->execute();
$sth->dump_results();
$sth->finish();
$dbh->disconnect();