Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

INSERT

  • INSERT
#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my $dbfile = "sample.db";

my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile");

my ($fname, $lname, $email, $pw) = qw(Moose Foobar moose@foobar.com really?);


$dbh->do('INSERT INTO people (fname, lname, email, pw) VALUES (?, ?, ?, ?)',
            undef, 
            $fname, $lname, $email, $pw);

We might need to insert some data.