do() method prepares and executes nonselect, nonrepeating statements in one step. : insert « Database « Perl






do() method prepares and executes nonselect, nonrepeating statements in one step.

   

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

   
    
    
  








Related examples in the same category

1.Simple Inserts
2.Using Multiple Placeholders
3.Using Placeholders to Insert Multiple Records