List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:July 15 1999 12:09pm
Subject:Re: Strange error inserting string with "%" characters.
View as plain text  
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("CREATE TABLE TEST (VAL VARCHAR(32))");

  my $sth = $dbh->prepare("INSERT INTO TEST (VAL) VALUES (?)");
  $val = "Doe%2C%20John";

  $sth = $dbh->prepare("SELECT * FROM TEST");
  while (my $ref = $sth->fetchrow_hashref()) {
    print "VAL = $ref->{'VAL'}\n";

And it seems to work fine. If you still think you are having problems,
please send a complete sample script.



Jochen Wiedmann						joe@stripped
Life has brown and green eyes. :-)			+49 7123 14887

Strange error inserting string with "%" characters.Andrew K Smith15 Jul
  • Re: Strange error inserting string with "%" characters.Jochen Wiedmann15 Jul