in reply to DBD::MySQL bind variable error

In addition to japhy's comment, I should also point out that by re-preparing the statement each time you go to execute it you're largely losing the value of having a prepared statement. Instead, try prepareing the statement outside the loop and then executing it for each message inside the loop, passing in the appropriate set of bind values each time.

Replies are listed 'Best First'.
Re^2: DBD::MySQL bind variable error
by UnderMine (Friar) on May 12, 2006 at 22:04 UTC
    Something like this at the start
    $command='insert into mailstore.received (SenderName,SenderEmailAddres +s,SentOnBehalfOfName,ReplyRecipientNames,SenderEmailType,SentOn,Recei +vedTime,MessageClass,Size,Subj,SentTo,Unread,InternetCodepage,importa +nce,EntryID,ConversationIndex,ConversationTopic,Class,BodyFormat,Body +) values (?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?)'; $sth=$dbh->prepare($command);
    and in the loop
    @values= map $msg->{$_}, qw{SenderName SenderEmailAddress SentOnBehalf +OfName ReplyRecipientNames SenderEmailType SentOn ReceivedTime Messag +eClass Size Subj SentTo Unread InternetCodepage importance EntryID Co +nversationIndex ConversationTopic Class BodyFormat Body} ; $rv=$sth->execute(@values);
    UnderMine