![]() |
|< 1 2 >| | ![]() |
13 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12
$dbh->{AutoCommit}= 0; #Für Transaktion eval { bestellung_speichern ($dbh, $bestell_info) and $dbh->commit (); }; if ($@) { #hat nicht Funktioniert $dbh->rollback (); $dbh->disconnect (); $peh->schwerer_fehler ("Ein Problem mit der Datenbank ist aufgetreten.Bitte versuchen sie es noch einmal."); } $dbh->{AutoCommit} = 1; #Transaktion abgeschlossen
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 35 36 37 38 39
sub bestellung_speichern { my ($dbh, $bestell_info) = @_; #Datensatz in doku_bestell $dbh->do ("INSERT INTO doku_bestell (bestell_datum, bestell_preis, aut_id, kunden_name, kunden_email) VALUES (CURRENT_DATE,?,?,?,?)", undef, $bestell_info->{gesamtpreis}, $bestell_info->{aut_id}, $bestell_info->{kunden_name}, $bestell_info->{kunden_email} ); #Bestell_id ist der Auto_Increment wert von eben $bestell_info->{bestell_id} = $dbh->{mysql_insertid}; #für jedes Dokument einen Datensatz in doku_posten for (@{$bestell_info->{posten}}) { #Passwort für das Dokument erzeugen und speichern my $passwort = passwort (); my $a; #Erzeugt die Links zu den Dokumenten $a = sprintf ("dokument.cgi?bestellung=%s;doku=%s;password=%s", escape ($bestell_info->{bestell_id}), escape ($_->{doku_id}), escape ($passwort) ); $_->{url} = $peh->haupt_url () . $a; $dbh->do ("INSERT INTO doku_posten (bestell_id, doku_id, preis, passwort) VALUES (?,?,?,?)",undef, $bestell_info->{bestell_id}, $_->{doku_id}, $_->{preis}, $passwort ); } }
QuoteWarning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in E:\WWW\root\archiv\archiv.php on line 16
Warning: mysql_select_db(): Can't connect to MySQL server on 'localhost' (10061) in E:\WWW\root\archiv\archiv.php on line 17
Warning: mysql_select_db(): A link to the server could not be established in E:\WWW\root\archiv\archiv.php on line 17
QuoteDBI connect('host=localhost;database=webdb','root',...) failed: Can't connect to MySQL server on 'localhost' (10061) at WebDB.pm line 15
![]() |
|< 1 2 >| | ![]() |
13 Einträge, 2 Seiten |