Leser: 1
![]() |
![]() |
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
$dbh->do(
qq{INSERT INTO tabelle (Feld1,Feld2,Feld3,Feld4) VALUES(?,?,?,?)},
undef,
$wert1,
$wert2,
$wert3,
$wert4
);
perldoc DBI
1
2
my $sth = $dbh->prepare(qq{INSERT INTO tabelle (Feld1,Feld2,Feld3,Feld4) VALUES(?,?,?,?)});
$sth->execute($wert1,$wert2,$wert3,$wert4);
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
28
29
30
31
32
33
34
#!/usr/bin/perl
use warnings;
use strict;
use CGI;
use DBI;
my $obj = new CGI;
my $dbh = DBI->connect ( "DBI:Pg:dbname=test1", "postgres", "sonderbar" )
or die "Keine Verbindung mit der DB!\n";
my $vorname = $obj->param ( "vorname" );
my $nachname = $obj->param ( "nachname" );
my $strasse = $obj->param ( "strasse" );
my $plz = $obj->param ( "plz" );
my $wohnort = $obj->param ( "wohnort" );
my $email = $obj->param ( "email" );
$dbh->do ( "INSERT INTO test1 VALUES ( '$vorname', '$nachname', '$strasse', '$plz', '$wohnort', '$email' )" );
print $obj->header ( "text/html" ),
$obj->start_html ( -title => "Bestätigung" );
print $obj->h3 ( "Das haben Sie eingegeben! \n" );
print $obj->h5 ( $vorname, " ", $nachname );
print $obj->h5 ( $strasse );
print $obj->h5 ( $plz, " ", $wohnort );
print $obj->end_html;
$dbh->disconnect();
exit;
QuoteUnd bist du dir sicher, dass Datenbank und Tabelle beide "test1" heissen?
1
2
3
4
5
6
7
8
$dbh->do( qq{INSERT INTO kunde (v_name, n_name, strasse, plz, wohnort, email) VALUES(?,?,?,?,?,?)},
$vorname,
$nachname,
$strasse,
$plz,
$wohnort,
);
QuoteDBI::st=HASH(0x821c340)->_prepare(...): attribute parameter 'thoams' is not a ha
sh ref at /usr/lib/perl5/DBD/Pg.pm line 172.
$rows = $dbh->do($statement, \%attr, @bind_values) or die...
1
2
3
4
5
6
7
8
9
$dbh->do( qq{INSERT INTO kunde (v_name, n_name, strasse, plz, wohnort, email) VALUES(?,?,?,?,?,?)},
undef,
$vorname,
$nachname,
$strasse,
$plz,
$wohnort,
);
![]() |
![]() |
10 Einträge, 1 Seite |