I am trying to query my database to get information for a specifc user... in this case "gwalker". This is my code:
use strict; use DBI; $dbh = DBI->connect("DBI:mysql:gds:localhost", "tools", "obviouslyfake +passwd") or die ("No love for the DBI connect"); $sql = qq{ SELECT uname, fname, fgroup, dmod, accts FROM noctracker WH +ERE uname = 'gwalker'} ; $sth = $dbh->prepare( $sql ) or die ("Could not prepare select"); $sth->execute(); $sth->bind_columns( undef, \$uname, \$fname, \$fgroup, \$dmod, \$accts + ); while ( $sth->fetch ) { print "<BR> Matched username $uname for name: $fname "; } $sth->finish(); $rc = $dbh->disconnect or die ("No love for the DBI disconnect"); &footer; exit;
and the output, oddly enough is:
DBI::st=HASH(0x164ad0) Matched username for name:
Which is not what expected... that query works from the msql command line...
mysql> SELECT uname, fname, fgroup, dmod, accts FROM noctracker WHERE +uname = 'gwalker'; +---------+----------------+---------+---------------+---------------- +---------------+ | uname | fname | fgroup | dmod | accts + | +---------+----------------+---------+---------------+---------------- +---------------+ | gwalker | Glen G. Walker | GDS-NOC | 20030820 1700 | BASTION SECUREI +D THEQ CLARIFY | +---------+----------------+---------+---------------+---------------- +---------------+ 1 row in set (0.00 sec)

In reply to Another meek DBI question by coyotlgw

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.