Andrew K Smith wrote:
> I'm having a strange error using DBD::mysql when trying to insert a row
> into a table with one of its fields having a value with "%" characters
> in it. I am running the latest mysql on windows NT, and am accessing
> it through ActiveState Perl, and DBI through DBD::mysql.
Tried the following test script:
#!/usr/bin/perl -w
use DBI ();
my $dbh = DBI->connect("DBI:mysql:test", undef, undef, {RaiseError => 1});
$dbh->do("DROP TABLE IF EXISTS TEST");
$dbh->do("CREATE TABLE TEST (VAL VARCHAR(32))");
my $sth = $dbh->prepare("INSERT INTO TEST (VAL) VALUES (?)");
$val = "Doe%2C%20John";
$sth->bind_param(1,$val);
$sth->execute();
$sth->finish;
$sth = $dbh->prepare("SELECT * FROM TEST");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "VAL = $ref->{'VAL'}\n";
}
$dbh->disconnect();
And it seems to work fine. If you still think you are having problems,
please send a complete sample script.
Bye,
Jochen
--
Jochen Wiedmann joe@stripped
Life has brown and green eyes. :-) +49 7123 14887