Wise Monks,

I am searching a DBD:CSV database based on a unique key like 1234567801234. The code I am using is below:
my $query="SELECT * FROM $table WHERE (ukey = ?)"; my $sth=$dbh->prepare($query); $sth->execute($ukey);
where $ukey is from a hidden field in an html form.
I know everything up to this point works becasue if I change $query to  select * from $table where ukey = '1234567801234' I get the record back that I expect. But just using the posted code, I get nothing.

I thought it might be a quoting issue, but according to the docs, the use of placeholders takes care of those issues. I have other scripts performing searches that work just fine, but those scripts search text fields. I am assuming my problem is due to the fact that this is a number instead of text, but I am not sure how to get around the problem.

Help, I am very confused


Thanks much,

digger

In reply to SQL and Placeholders by digger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.