home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / xampp-win32-1.6.5-installer.exe / htdocs / contrib / testperldbi.pl < prev    next >
Encoding:
Perl Script  |  2007-12-20  |  444 b   |  22 lines

  1. #!/opt/lampp/bin/perl
  2. use DBI;
  3.  
  4. my $dsn = 'DBI:mysql:cdcol:localhost';
  5. my $db_user_name = 'root';
  6. my $db_password = '';
  7. my ($id, $password);
  8. my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
  9.  
  10. my $sth = $dbh->prepare(qq{
  11.     SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;
  12. });
  13. $sth->execute();
  14.  
  15. while (my ($id, $title, $interpret, $jahr ) = 
  16.     $sth->fetchrow_array()) 
  17. {
  18.      print "$title, $interpret\n";
  19. }
  20. $sth->finish();
  21.  
  22.