Monolith-0 has asked for the wisdom of the Perl Monks concerning the following question:
I don't know why it is when I try to INSERT a piece of text with a '?' in it, it ends up turning to 'NULL' in the DB. I'm not even sure if it's a Perl or MySQL database. I have, however, isolated the problem to a single function:
sub Do_SQL{ my ( $command )=@_; my $sth; eval{ $sth = $dbh->prepare($command); }; # Check for errors. if ($@){ $dbh->disconnect; print "Content-type: text/html\n\n"; print "An ERROR occurred! $@\n"; exit; } else { $sth->execute; } return $sth; }
For example sakes, I'll say that $command is something like:
INSERT INTO some_tbl (some_text) VALUES("Hello?")
What ends up in the DB (for the value some_text) is "HelloNULL". If I were to enter the exact same line manually into the DB, then it would work fine, and the question make would remain unchanged. I know the problem must be somewhere in that function, but I have no clue what it is.
Could someone please help me?
Also, is there some way the question mark is used as syntax in Perl? I apparently missed that info if it is true.
- Monolith
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: question mark?
by Trimbach (Curate) on Apr 29, 2001 at 05:16 UTC | |
by Monolith-0 (Beadle) on Apr 29, 2001 at 06:07 UTC | |
by Trimbach (Curate) on Apr 29, 2001 at 08:25 UTC | |
|
Re: question mark?
by DrZaius (Monk) on Apr 29, 2001 at 21:05 UTC | |
|
Re: question mark?
by sachmet (Scribe) on Apr 29, 2001 at 20:08 UTC |