in reply to Re: Perl DBI adding some, not all, records to MySQL database
in thread Perl DBI adding some, not all, records to MySQL database

It took a while, but this all eventually worked. The problem was almost certainly the single apostrophe, which I hadn't noticed. The code I'm using now reads:

my $sth = $db->prepare("insert into news(url, header, country, country +2, date, priority, userid, source, formoreinfo, language, regreqd, ke +ywords, image, actnowcampaigncode, state) values(?,?,?,?,?,?,?,?,?,?, +?,?,?,?,?)"); foreach $record (@records) { $n++; &splitupintofields; if ($priority > 0) { $y++; &convdate; &convlang; $sth->execute($url, $header, $country1, $country2, $date, $pri +ority, $correspondent, $source, $formoreinfo, $language, $regreqd, $k +eywords, $image, $actnowcampaigncode, $state); } } $db->disconnect();
  • Comment on Re^2: Perl DBI adding some, not all, records to MySQL database (Thank you!)
  • Download Code