chromatic has asked for the wisdom of the Perl Monks concerning the following question:
and your script like this:INSERT member (last, first) VALUES(NULL, "chromatic");
Printing your $query would reveal that $last and $first are not being quoted.$last = "NULL"; $first = "chromatic"; $query = qq { INSERT member (last, first) VALUES ($last, $first) }; $rows = $dbh->do($query);
The solution is to use something like this:
or this:$last = $dbh->quote("NULL"); $first = $dbh->quote("chromatic");
$query = qq { INSERT member (last, first) VALUES (?, ?) }; $rows = $dbh->do($query, undef, $last, $first);
Originally posted as a Categorized Question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does my query work on the command line, but fail in my browser?
by tommyw (Hermit) on Sep 18, 2001 at 18:02 UTC | |
|
Re: Why does my query work on the command line, but fail in my browser?
by cavac (Prior) on Jul 15, 2012 at 21:57 UTC | |
|
Re: Why does my query work on the command line, but fail in my browser?
by CMonster (Scribe) on Jul 07, 2000 at 22:05 UTC | |
|
Re: Why does my query work on the command line, but fail in my browser?
by Anonymous Monk on Jan 10, 2002 at 07:00 UTC | |
|
Re: My query works fine from the command line, but it fails in my script!
by Jonathan (Curate) on Apr 14, 2000 at 17:11 UTC | |
by athomason (Curate) on Jun 28, 2000 at 23:42 UTC | |
|
Re: Why does my query work on the command line, but fail in my browser?
by ralphie (Friar) on Sep 26, 2001 at 16:51 UTC |