I see what you're trying to do, and you're pretty close, but you're missing a couple important points. You want to have an extended number of rows from the query displayed in a ROText widget (which, by default, will be scrollable using arrow keys or the mouse scroll wheel). But, as pointed out above, your query returns only one row, and doesn't match up with your attempted use of bind_columns.

Try it like this (I'm only changing the bare minimum to do what I think you really want, but I'm not able to test it):

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::ROText; use DBI; ## use DBD::mysql; # DBI will do this for you when you connect our $type="mysql"; our $database="beezynet_db"; our $host="http://www.xsite.com/"; our $port="3306"; our $tablename="topic"; our $user="username123"; our $pwd="**************"; our $dsn="dbi:$type:$database:$host:$port"; my $query; my $queryhandle; our $connect=DBI->connect($dsn,$user,$pwd)or die &mysql_Err; my $mw=new MainWindow; $mw->geometry('400x400'); my $rotext=$mw->ROText()->pack; # I can only guess at the real column names - please fix them as neede +d: $query="SELECT id, item_name, item_price FROM items ORDER BY id"; my ( $id, $item_name, $item_price ); $queryhandle=$connect->prepare($query); $queryhandle->execute; $queryhandle->bind_columns(undef, \$id, \$item_name, \$item_price); while($queryhandle->fetch()){ # NB: use "end" instead of "1.0" here: $rotext->insert('end', "ID: $id\t Price:: $item_price\tName: \$ite +m_name"); } $queryhandle->finish; # $connect->disconnect; ## display will work, even while connected. MainLoop;
(I tested something pretty similar to that on a database of my own, so it ought to work for you.)

In reply to Re: Perl/Tk freezes while waiting the data to arrive on mysql server by graff
in thread Perl/Tk freezes while waiting the data to arrive on mysql server by Muskovitz

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.