Thread CSV Datei mit CGI öffnen (117 answers)
Opened by lolipop 999 at 2006-11-17 19:35

lolipop 999
 2006-12-10 11:19
#9064 #9064
User since
2006-04-07
150 Artikel
BenutzerIn
[default_avatar]
So habs jetzt übers CMD ausgeführt folgendes kommt dabei raus.

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>

<table>
<tr><td>DHL</td><td>K_N</td><td>Hellmann</td></tr>
</table>
<a href='Pie.cgi'>Zum Tortendiagramm</a>


Hier mein Code:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! f:/Perl/bin/perl -w

use strict;
use warnings;
use DBI;
use FindBin ();
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use HTML::Table;

my $dbh = DBI->connect("DBI:CSV:f_dir=".$FindBin::Bin) or die $DBI::errstr;
my $stmt = "SELECT * FROM Kunde";

my $sth = $dbh->prepare($stmt) or die $dbh->errstr();
$sth->execute() or die $dbh->errstr();

print header();
print start_html();
my $table2 = new HTML::Table;
$table2->addRow('DHL','K_N','Hellmann');
while(my @row = $sth->fetchrow_array()){
$table2->addRow(@row);
}
$dbh->disconnect;
$table2->print;

print qq~<a href='Pie.cgi'>Zum Tortendiagramm</a>~;


Scheint leider nicht zu funzen da die einträge der tabelle nicht dargestellt werden.

Danke für die Hilfe

lolipop 999
Antworten mit Zitat

View full thread CSV Datei mit CGI öffnen