in reply to Re: Perl cant connect to null mysql table
in thread Perl cant connect to null mysql table

Sorry! This is some test code. If the table dont have any data, this sub doesn't work, my perl page is not response anything, my browser => "Waiting for localhost..." forever !!! So i cant see any error.
sub checkGroupExist { eval{$mysql=Net::MySQL->new(hostname=>"localhost",database=>"check +k",user=>"root",password=>"pw")}; my ($grname)=@_; if(!$@) { $mysql->query(qq{Select GROUP_NAME from PROJECT_GROUP where GR +OUP_NAME='$grname'}); my $record_set=$mysql->create_record_iterator(); my $record=$record_set->each(); if($record) { return 1; } $mysql->close(); } else { print qq{Can't connect to database. Check your config in 'conf +ig.pl'}; exit; } return 0; }
I see when a perl page run in the browser, there is a program 'perl.exe' in my Window Task Manager. The page load completely and this programe disappear.
With my error, is see in my Task Manager have a task with name 'perl.exe' and it's never disappear. I refresh the page and i have one more!!!

Replies are listed 'Best First'.
Re^3: Perl cant connect to null mysql table
by Corion (Patriarch) on Jun 06, 2009 at 14:34 UTC

    Maybe you should remove the CGI part then, and debug the SQL part alone. I don't see anything obvious why your code should fail or enter a long loop. But as you haven't shown a self-contained example, it's hard to tell.

      Yes, i dont understand too.
      All of SQL query worked when i test them in phpmyadmin. And my page worked very well if the table in database have greater than two records!!!lol!
      My perl page look like "loop forever" if mysql tables dont have any record.
      I have to insert two record into those tables, if not i cant continue my work.Maybe i must find another server and test them again.

      Thanks for reply me :D

        You could also try to reduce your program until it has only 20 lines or so but still has the "endless looping" problem, and then post it here. Preferrably, you should start with removing the CGI part, as running a Perl script from the command line is more convenient. We can't help you much without seeing your code.