in reply to Help me ! I am stuck ! PERL DBI

If there are no rows returned, the sub you have never does a return at all. Instead, it goes on to call $sth->finish() and $db->disconnect() (both of which are unnecessary) and finally exit, which is what terminates the program. If you want to print or do anything after calling connectCBMS, change exit(0) to return.

Note also:

I hope this helps.

Replies are listed 'Best First'.
Re^2: Help me ! I am stuck ! PERL DBI
by Anonymous Monk on Oct 13, 2007 at 03:35 UTC
    Hi Kyle , 
    
    Exactly ! you are 100 % correct . 
    Now it works with "return" instead of exit.
    Thanks a lot .
    
    
    Also Thanks for you review on my coding standard.
    1. Actually I will write all warning/error mesg into a log file.
    2.ofcourse i will put my   ($staffcode) = @_;  to the top most in the sub.
    3. You mean to say that use " sth->fetchrow_array"  instead of  ($sth->fetchrow_array()) ???
    4.I will learn abt use strict and let me...
    
    
    Thanks a lot. 
    Suriya
    
      You might wish to get in a habit of checking for $err as well. In some situations, if you $sth->execute fails, and you $sth->fetchrow Perl may (will) exit entirely. Checking for errors is a good habit to get into -- it will prepare you for the 'next database'
      spectre#9 -- more dangerous than acme