my $dbh = DBI->connect('DBI:mysql:nikos_db', 'root', 'censored') or {R +aiseError=>1}; my $rep = $dbh->prepare( "REPLACE INTO `games` (`gamename`, `gamedesc` +, `gamecounter`) VALUES (?, ?, ?)" ); open (FILE, "<../data/games/descriptions.txt") or die $!; while (<FILE>) { chomp; $rep->execute( split(/\t/, $_, 2) , 0 ) or print $dbh->errstr; } close (FILE); $rep->finish; $dbh->disconnect;
In reply to Re: Updating or Inserting a database from a txt file
by Adrade
in thread Updating or Inserting a database from a txt file
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |