use DBI; ############################################################ # Connect to Database Named cctvimages on the localhost with the root user # # $dbh=DBI->connect(DBI:mysql;$database", $user, $password); ############################################################ my $dbh = DBI->connect("DBI:mysql:database=cctvimages; host=localhost", "xxxx", "xxx", {'RaiseError' => 1}); ############################################################ # Insert the image_name, image_size and the image_date_modified to imageheader table# # with the values from renamed images coming from /home/me/images/ # ############################################################ $statement = "INSERT INTO imageheader (image_name, image_size, image_date_modified) VALUES ('$image_name', '$image_size', '$image_date_modified')"; $sth = $dbh->prepare($statement) or die "Can't prepare $statement: " . $dbh->errstr . "\n"; $sth->execute or die "Can't execute the query: " . $dbh->errstr . "\n"; $sth->finish; $dbh->disconnect();