|< 1 2 >| | 16 Einträge, 2 Seiten |
1
2
INSERT INTO Beispiel (beispiel1,beispiel2,beispiel3) VALUES(?,?,?),
undef,test1,test2;
1
2
3
4
5
6
7
8
9
10
11
12
13
my %element;
$element{liste} =
[
{ art => "textfield", name => "nachname",
bez => "Nachname:", size => 20},
{ art => "textfield", name => "vorname",
bez => "Vorname:", size => 20},
{ art => "popup_menu", name => "zimmerbett",
bez => "Zimmer/Bett:",},
{ art => "popup_menu", name => "anrede",
bez => "Anrede:",},
....
]
1
2
INSERT INTO kontakte (nachname,vorname,zimmerbett,anrede,...) VALUES(?,?,?,?,...),
"param ('nachname')","param ('vorname')","param ('zimmerbett')","param ('anrede')";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my %mappings_form2db = (
# form => db
counter => 'count' ,
name => 'name' ,
tel => 'telephoneNumber',
);
my $cgi = CGI->new();
my %params = $cgi->Vars();
# hier dann die gueltigkeit ueberpruefen
# ...
# und dann das sql bauen:
my $sql = qq~INSERT INTO table (~
. join (', ', values %mappings_form2db)
. qq~) VALUES (~
. join(', ', map { $dbh->quote($params{$_} ) } keys %mappings_form2db
. ")";
|< 1 2 >| | 16 Einträge, 2 Seiten |