i'm trying to keep my code nice and clean and one of the ways i'm doing this is keeping all the sql request code in one module the problem is: it's not working.
basically, all i really want is a subroutine call in my cgi that looks like this: my $dbh = DBI->connect('DBI:mysql:xxxxxx', 'xxxxxx', 'xxxxxx', {RaiseError => 1, AutoCommit => 0}); mySQL($dbh, "SELECT whatever FROM whatever WHERE something='asdf'"); mySQL($dbh, "SELECT whatever FROM whatever WHERE something='asdf'"); mySQL($dbh, "SELECT whatever FROM whatever WHERE something='asdf'"); $dbh -> disconnect; all the $dbh = DBI.... stuff taken care of in a module: sub mySQL { my($query) = "$_[1]"; my $output = $_[0]->prepare($query); $output -> execute; my(@sqldata) = $output -> fetchrow_array; $output -> finish; return @sqldata; } but instead, the error log feeds me this: Can't locate object method "prepare" via package "DBI::db=HASH(0x822dd00)" at mySQL.pm line 18. what i'm using: red hat 7.2 perl 5.6.0 mySQL 3.23.47 apache 1.3.23 thanks all --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php