Hi all
Done lots of googling but this simple thing still has me stumped
The perl code to insert stuff into an mysql table is this
my $Vals;
for ( my $i=1;$i<=32;$i++ ) {
$Vals.='?,';
}
chop $Vals;
my @TheRecord=&GenMainRecData();
my $sth = $dbh->prepare("INSERT INTO mytable VALUES($Vals)");
$sth->execute(@TheRecord);
This works fine until I have single quores (') in the data eg O'Connor etc
The data saved in the field ends up being OConnor
I've tried putting \\\' in the string but this gives me O\Connor
I've also tried
my @TheRecord=&GenMainRecData();
my $fld;
my @Processed;
foreach $fld (@TheRecord){
push (@Processed,$dbh->quote($fld));
}
my $sth = $dbh->prepare("INSERT INTO CAFamilyDay2005 VALUES($Vals)");
$sth->execute(@Processed);
But this just seems to put quotes in EVERY field
Thanks in advance for you help
Your stumped !
Andrew Kennard
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>