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)