Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use DBI;
- $database = "onomavasis";
- $hostname = "tohostname";
- $port = "3306";
- $username = "tousername";
- $password = 'okwdikos';
- $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
- $dbh = DBI->connect($dsn, $username, $password) or die("Could not connect!");
- $sql = "SELECT * FROM mytable";
- $sth = $dbh->prepare($sql);
- $sth->execute;
- while(($column1, $column2) = $sth->fetchrow_array)
- {
- print "C1 = $column1, C2 = $column2n";
- }
- $dbh->disconnect;
Add Comment
Please, Sign In to add comment