Help for this page

Select Code to Download


  1. or download this
    my $query = "SELECT * FROM users WHERE user=?";
    my $sth = $dbh->prepare($query);
    ...
    my $row = $sth->fetchrow_hashref();
    # Then you could call the new method:
    my $user_info = User->new($row);
    
  2. or download this
    package User;
    
    ...
         my($class,$user_info) = @_;
         return bless $user_info,$class;
    }