I am trying to write a package that will execute a sql statement for me in my cgi pages, the following is the code for the package, but when I run it at the command prompt I get error messages about the first line where I set the $dsn. I think the problem is with the use of DBI. The sql that I pass to this package does not get executed. I call the package on my cgi page with:
$s = GetRecords->Execute_SQL($sql); Can anyone tell me what I am doing wrong? package GetRecords; use DBI; sub Execute_SQL{ my ($dsn) = "DBI:mysql:getgreen:localhost"; my ($user_name) = "anya"; my ($password) = "anya"; my ($dbh, $sth); my ($result, @ary, @matrix); my ($sql); $sql = shift @_; if ($sql){ #EXECUTE QUERY $dbh = DBI->connect ($dsn, $user_name, $password, {RaiseError=>0}) or die "Could not connect to server:$DBI::err($DBI::errstr)\n"; $sth = $dbh->prepare($sql); $sth->execute(); $result = 1 if ($sth); return $result; } } 1; Thanks in advance for your help. Anya Miretsky Computer Technology Dept. Brooklyn Botanic Garden 1000 Washington Avenue Brooklyn, NY 11225 (718)623-7265 [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]