in reply to how to put this db connection code into a function
sub connect { return DBI->connect( "DBI:mysql:".join(';', "database=$sql_database", "host=$sql_host", "port=$sql_port", ), $username, $password, { RaiseError => 0, AutoCommit => 1, }, ); }; my $dbh = connect() or die("Can't connect: $DBI::errstr\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to put this db connection code into a function
by ikegami (Patriarch) on Jan 04, 2011 at 23:28 UTC | |
by Anonymous Monk on Jan 05, 2011 at 00:19 UTC | |
by ikegami (Patriarch) on Jan 05, 2011 at 01:11 UTC |