Skip to Content
Perl by Example
book

Perl by Example

by Ellie Quigley
December 2014
Beginner
888 pages
25h 23m
English
Addison-Wesley Professional
Content preview from Perl by Example

Chapter 15. Perl Connects with MySQL

Image

By the time you finish this chapter, you should be able to read and write the following Perl code:

use DBI;$dbh = DBI->connect('dbi:mysql:sample_db','root','letmein') or die   "Connection Error: $DBI->errstr\n";$sql = "select * from teams";$sth = $dbh->prepare($sql);$sth->execute  or die "SQL Error: $sth->errstr\n";while (@row = $sth->fetchrow_array) {   print "@row\n";}$sth->finish;$dbh->disconnect;

15.1 Introduction

The user has filled out a form and submitted it with a list of items he wants to purchase. Information for that user is stored in a database in a table called

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Perl

Beginning Perl

Curtis Ovid Poe
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe
Mastering Perl

Mastering Perl

brian d foy
Learning Perl 6

Learning Perl 6

brian d foy

Publisher Resources

ISBN: 9780133593068Purchase book