hey perl mongers i have scripted a little program of perl/tk that will connect to mysql db and then process the query search and then prints out the results but it gets hang sometimes it wont load.
#!/usr/bin/perl use strict; use warnings; use Tk; use DBI; use DBD::mysql; our $type="mysql"; our $database="store"; our $host="somesite.com"; our $port="3306"; our $tablename="vegetables"; our $user="example"; our $pwd="*********"; our $dsn="dbi:$type:$database:$host:$port"; our $query; our $queryhandle; our $connect=DBI->connect($dsn,$user,$pwd) || die "ERROR: $!\n"; my $mw=new MainWindow; $mw->Lable(-text=>"Search for vegetables")->pack; my $veges=$mw->Entry()->pack; $mw->Button(-text=>"Search",-command=>\&search)->pack; sub search{ my $sv=$veges->get();$veges->delete(qw/0 end/); $query="SELECT * FROM vegetables WHERE vegetable LIKE '%$sv%'"; $queryhandle=$connect->prepare($query); $queryhandle->execute; while($queryhandle->fetch()){ $mw->Label(-text=>"Vegetables Found for: $sv")->pack; } } MainLoop;
I'll go for sleep for now just leave a comment guys i'll back reading it tomorrow! thanks in advance.
In reply to Perl/Tk hang when conecting to Remote MySQL Server by Muskovitz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |