It would definitely help if you post source-code.
This might not be what you're looking for, but the general syntax for
INSERTs might be something like:
use DBI;
use strict;
my $user = 'username';
my $pass = 'password';
my $dbh = DBI->connect('dbi:MySQL:<db_name>', $user, $pass);
my $sql = '
INSERT INTO TEMP(
FIELD1,
FIELD2,
FIELD3)
VALUES (?,?,?)';
my $sth = $dbh->prepare($sql);
open(IN, 'emails.txt');
while (<IN>) {
my ($val1, $val2, $val3) = split("\t");
$sth->execute($val1, $val2, $val3);
$dbh->commit();
}
close(IN);
On Wed, 26 Feb 2003, gregg wrote:
> No. I'm not using placeholders. I'm stuffing all my INSERT variables
> into a "DO" statement. The one example I found on place holders was a
> "any DBI" example for "SELECT" not "INSERT." I changed the syntax and
> I didn't get an error but it wasn't inserted either.
>
> Thanks.
>
>
> On Wednesday, February 26, 2003, at 11:15 AM, PARLEY,THUNDER
> (HP-MountainView,ex1) wrote:
>
> > You are using placeholders, right? ;-)
> >
> > --Thunder
> >
> > -----Original Message-----
> > From: gregg [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 26, 2003 9:11 AM
> > To: [EMAIL PROTECTED]
> > Subject: MySQL DBI problem
> >
> > I am trying to read email off a mail server using perl, parse it, and
> > then store the fields in a MySQL database. I managed to write the
> > first two parts in a couple of days, but now I've spent two weeks
> > trying to get the fields into a the "Messages" database. I have got
> > several fields to go in and then I ran the same script the next day
> > with no changes and it wasn't working any longer.
> >
> > I have run into about every problem imaginable and I can't get a stable
> > script. Once when I thought I had it working, the script started
> > carping because there were embedded quotes in the email body which it
> > interpreted as delimiters. I tried the "qw" function and it was
> > bitching about another syntax problem.
> >
> > I have a few books on Perl that have DBI examples but they are not made
> > for MySQL and the examples are very Mickey Mouse compared to what I'm
> > trying to do. Any suggestions or directions to potential resources
> > will be greatly appreciated.
> >
> > Thanks in advance,
> >
> > Gregg
> >
> >
>