Preparing a Statement Handle and Fetching Results : MySql « Database « Perl






Preparing a Statement Handle and Fetching Results

   

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();

   
    
    
  








Related examples in the same category

1.Deleting Entries
2.Dumping a Query's Results
3.Error Diagnostic Variables
4.Handling Quotes
5.Inserting into a Database
6.Load text file to database
7.MySQL Data Types
8.Pushing Query Results to an Array to Find Wildcard Hosts
9.Query parameter binding
10.Retrieving Query Results Listing MySQL Users and Hosts
11.Retrieving an Index ID