Ok here's the dilly-yo.

I've got a Perl app using DBI with a MySQL database. I keep getting an error and I can't spot why(neither can my boss). So I'm wondering if there are any bugs with our versions of DBI or DBD::mysql(or my app for that matter ;).

Okay here's code in abbreviated form. The parts that involve the error are exact:

use DBI; use strict; # query in question my $sth_sts = $dbh->prepare("UPDATE players SET t_id=?, bats=?, throws +=?, status=? WHERE id=?"); my $i; foreach $i (0 .. $#$prec) { # $prec is defined elsewhere # blah # blah # blah # blah # execute in question $sth_sts->execute($tid,$p->{P_BATS},$p->{P_THROWS},$p->{P_STATUS}, +$p->{P_PLAYERID}) or print "$DBI::errstr\n"; # blah }
And the error:
Unknown column 'R' in 'field list'
And a sample of what the values plugged into the query should be:
$tid = 20; # or any other 2 digit int $p->{P_BATS} = 'R'; # or 'L','S' $p->{P_THROWS} = 'R'; # or 'L' $p->{P_STATUS} = 'A'; # or 'D','I','M' $p->{P_PLAYERID} = 1846404; # or any other int up to 10 digits

Also, I figured you'd probably like to know the versions of DBI and DBD::mysql...oh and Perl ;)

Again, I'm at a complete loss. I thought it might be a problem with the quoting of the variables(which still seems likely to me), but I can't figure out where the problem is occuring or how to fix it.

Thanks in advance.

Amel - f.k.a. - kel


In reply to DBI/DBD::mysql bugs? by dsb

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.