Fixed stupid typos bugs.
[reportero_perl.git] / reportero
blob3443777d4cdf36290e8ebce778095c114b341ea8
1 #!/bin/env perl
2 # Test reporting program
4 use warnings;
5 use DBI;
6 use CGI qw(:standart);
7 use CGI::Carp qw(fatalsToBrowser);
10 $db_name = "tarificador";
11 $db_host = "localhost";
12 $db_user = "tarificador";
13 $db_passwd = "n3ur0d3s4rr0ll008";
15 sub
16 db_search
18   my $dbh = shift ;
19   my $sql = param('sql');
21   my $sth = $dbh->prepare("$sql");
22   $sth->execute();
24   print <<'  END'
25     <html>
26     <head></head>
27     <body>
28   END
29   ;
31   my $count;
32   while (my $hash = $sth->fetchrow_hashref)
33   {
34     print 
35       "$hash->{id},$hash->{fecha_hora},$hash-{origen},$hash->{destino}<br/>";
36     $count++;
37   }
39   print <<'  END'
40     </body>
41     </html>
42   END
43   ;
46 my $dbh = $DBI->connect("dbi:mysql:dbname=$db_name,hostname=$db_host"
47     , "$db_user", "$db_passwd")
48     or die "ERROR: Cannot connect to DB: $DBI::errstr!\n";
50 db_search($dbh);