hi,
I write a script that does extract data from a dbf file and insert the value into mysql. After I ran it, it does not insert the data into mysql.
the script:
#!/usr/bin/perl -w
use strict;
use DBI;
use DBI;
my ( $brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna ) = "";
my $dbh = DBI->connect("DBI:XBase:h:\/fuboru\/dataIMS" ) or die $DBI::errstr;
my $sth = $dbh->prepare("select brg from hipdf02") or die $dbh->errstr();
$sth->execute();
$sth->execute();
while (my $row = $sth->fetchrow_arrayref() ) {
#my ( $brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna ) = @$row;
my ( $brg ) = @$row;
$dbh->do( "INSERT INTO hipdf02 (brg, nama, jenis, stn, hbeli, maxi, mini, stn2, isi, hpp, hbesar, hkecil, mvc, lks, sup, merek, part, type, nama2, klink, hp_std, qprod, qsales, tgl_klr, warna )
VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )",
undef, $brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna );
#my ( $brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna ) = @$row;
my ( $brg ) = @$row;
$dbh->do( "INSERT INTO hipdf02 (brg, nama, jenis, stn, hbeli, maxi, mini, stn2, isi, hpp, hbesar, hkecil, mvc, lks, sup, merek, part, type, nama2, klink, hp_std, qprod, qsales, tgl_klr, warna )
VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )",
undef, $brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna );
print "$brg, $nama, $jenis, $stn, $hbeli, $maxi, $mini, $stn2, $isi, $hpp, $hbesar, $hkecil, $mvc, $lks, $sup, $merek, $part, $type, $nama2, $klink, $hp_std, $qprod, $qsales, $tgl_klr, $warna\t\t transferred\n";
}
$dbh->disconnect();
do you mind if someone can tell me what is wrong with the code?
I am looking
forward to a favorable reply from you. Thank you.
Feel free to call! Free PC-to-PC calls. Low rates on PC-to-Phone. Get Yahoo! Messenger with Voice
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
