10 entries, 1 page |
1
2
3
4
5
6
7
8
9
10
11
12
$sth = $dbh->prepare(" SELECT * FROM dat1 ORDER BY id LIMIT 15 " );
$sth->execute();
$dat = $sth->fetchall_arrayref();
$sth->finish();
foreach (@$dat)
{
@zeile = @{$dat->[$i++]};
print " Zeile: $i : @zeile \n";
}
#nur letzte Zeile einfügen
$sql = qq{ INSERT INTO dat2 VALUES @zeile };
$sth = $dbh->do($sql);
1
2
3
4
5
[...]
$sql = qq{ INSERT INTO dat2 VALUES (?)};
$sth = $dbh->prepare($sql);
$sth->execute(@zeile);
[...]
Quoterenee,01.04.2004, 09:55]Ist in der Zeile, die Du einfügen willst vielleicht ein ' ??
1
2
3
4
5
6
[...]
@zeile = map{$dbh->quote($_)}@zeile;
$sql = qq{ INSERT INTO dat2 VALUES (@zeile)};
$sth = $dbh->prepare($sql);
$sth->execute();
[...]
1
2
3
my $sql = qq|INSERT INTO dat2 VALUES (| . join(', ',map { $dbh->quote($_) } @zeile) . qq|)|;
my $sth = $dbh->prepare($sql) or die $dbh->errstr();
$sth->execute();
1
2
3
$sql = qq{ INSERT INTO dat2 VALUES (}. (join ',', ('?')x 16) . ')';
$sth = $dbh->prepare($sql);
$sth->execute(@zeile);
qq{ INSERT INTO dat2 VALUES (}. (join ',', ('?')x 16) . ')';
10 entries, 1 page |