Re: getting data from one table, putting it into another...

2002-06-26 Thread Robert Thompson
This is more of an MySQL question than a Perl question, but here goes: A possible error is that you are inserting into the same table you are selecting from. > my $sth = $dbh->prepare( "SELECT * FROM board where serial='CN+/P422'" ) || > my $sth2 = $dbh->prepare("INSERT INTO board @abfrage")

RE: getting data from one table, putting it into another...

2002-06-26 Thread Kipp, James
> > #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"); I think you need to interate through the array and split into the fields of your table then you can us

RE: getting data from one table, putting it into another...

2002-06-26 Thread Hanson, Robert
Always use placeholders, this should help... my @abfrage = $sth->fetchrow_array; # build placeholders based on num of fields my $placeholders; $placeholders .= ($placeholders ? ",?" : "?") for (@abfrage); my $sth2 = $dbh->prepare("INSERT INTO board $placeholders"); $sth->execute(@abfrage); The