modification of perl tk code
Posted on 2004-08-25
i have this perl tk code to connect to the database.
it will print the output of the search result($dir)on to the gui($text).
the problem i faced now, is that the "$dir" could not be printed out as what is being stored in the db.
instead it print out "0".
how do i modify this code.
Perl tk code
$dbh = DBI->connect( 'dbi:mysql:rvsi')||
die "Cannot connect to database: $dbh->errstr\n";
$sql = 'SELECT dir FROM tray WHERE job = "$job" AND date = "$date"';
$sth = $dbh->prepare($sql) || die "Couldn't prepare: $dbh->errstr\n";
$dir = $sth->execute;
$text->insert('1.0',"\n\n Tray Report Result\n\n");
$text->insert('end',"Job specification: $job\n\n");
$text->insert('end',"Directory path: $dir\n\n");