Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.65 KB | None | 0 0
  1. #!/usr/local/bin/perl
  2.  
  3. use strict;
  4. use CGI;
  5.  
  6. use DBI;
  7.  
  8. use CGI::Carp qw(fatalsToBrowser);
  9.  
  10. my @row;
  11. my $q = CGI->new;   # suzadava obek ot tip CGI
  12.  
  13. print $q->header(); # metoda header vrushta kato text
  14.  
  15.  
  16.  
  17. #my $username = $q->param("username");
  18. #my $password = $q->param("password");
  19. #my $email = $q->param("email");
  20.  
  21. my $dbh = DBI->connect("dbi:ODBC:sql_perl", 'sa', 'sa991');
  22.  
  23.  
  24.  
  25. my $sth = $dbh->prepare("SELECT * from users");     # prepare the query
  26. $sth->execute();   # execute the query
  27.  
  28.  
  29.  
  30. @row = $sth->fetchrow_array;
  31. print @row;
  32. while (@row = $sth->fetchrow_array) {  # retrieve one row
  33.     print join(", ", @row), "\n";
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement