in reply to Updating or Inserting a database from a txt file
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Updating or Inserting a database from a txt file
by Nik (Initiate) on May 11, 2005 at 07:11 UTC | |
by Adrade (Pilgrim) on May 12, 2005 at 09:11 UTC | |
by Nik (Initiate) on May 12, 2005 at 10:22 UTC | |
by Nik (Initiate) on May 11, 2005 at 12:54 UTC | |
by bart (Canon) on May 12, 2005 at 07:36 UTC | |
by Nik (Initiate) on May 12, 2005 at 07:37 UTC |