Hi there, again one (probably simple) question: I have two databases and want to put the data from one table into the same table in the other database... Doing it like follows up gives me the right values, (like i can see from the later Output) but doesnt write into the second table... Any suggestions? Its Probably a problem from the array i guess...
Greets Johannes #/usr/lib/perl -w # # #Script um Teres Datenbank auszulesen un Daten in Direx zu schreiben # # Compilerpragma strict um keine Fehler zu machen :-) use strict; # Benutzung der Perl-Module CGI und DBI use CGI; use DBI; my $user = "root"; my $pwd = ""; # connect to databases my $dbh = DBI->connect( 'dbi:mysql:DiREx',$user,$pwd)|| die "Kann keine Verbindung zum MySQL-Server aufbauen: $DBI::errstr\n"; my $dbh2 = DBI->connect ( 'dbi:mysql:dirextest',$user,$pwd)|| die "Kann keine Verbindung zum MySQL-Server aufbauen: $DBI::errstr\n"; # prepare sql query # Handle Objekt wird zurueckgeliefert my $sth = $dbh->prepare( "SELECT * FROM board where serial='CN+/P4226666'" ) || die "Kann Statement nicht vorbereiten: $DBI::errstr\n"; # execute query $sth->execute || die "Kann Abfrage nicht ausfuehren: $DBI::errstr\n"; #put values into an array my @abfrage = $sth->fetchrow_array; #prepare insert of values from the array in second database my $sth2 = $dbh->prepare("INSERT INTO board @abfrage"); #execute insert $sth->execute|| die "Kann Abfrage nicht ausfuehren: $DBI::errstr\n"; while ( my @ergebnis = $sth->fetchrow_array ){ # Im Array @ergebnis steht nun ein Datensatz #print "<LI>".$ergebnis[1]." ".$ergebnis[2]." ".$ergebnis[3]." ".$ergebnis[4]. "\n"; print "@ergebnis\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]