I would connect using:
my $dbh=DBI->connect($SID, $user, $pass, {RaiseError=>1});
and avoid typing all the '.. or die' clauses. Because if you get an error, it gives
you a place to start looking and if you need to, you can just add a debug 'print' statement
before the failing statement on the next go round.
That being said, there should be no reason why your statement can not
find fields with spaces in them. My guess is that either the prepare
is failing or your bind variable has characters besides spaces
that you're not expecting. Maybe you need to convert
the bind_variable to hex and print that out to see if there
are any weird characters like linefeeds sneaking in. One guy I worked
with swore up and down that "placeholders don't work" and
he avoided using them, and we found that the input was
getting a carriage return character. (He also complained that
"arrays don't work" for similar reasons, but that's another
story - he would always avoid using things instead of debugging
and figuring out what's wrong).
Also, I hope that you don't really have
html breaks in the middle of your sql statement because
that definitely would cause the prepare to fail.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.