Thanks,
The snippet now looks like this:
my $db = new Win32::ODBC('$DSN');
if (defined $dept) {
if (exists $labels{$dept}) {
# FIXME
# untaint $dept and put it into database
print
$cgi->start_html,
$cgi->p("$dept was received.");
$cgi->end_html;
if ($dept eq "CA") {
if (!($db=new Win32::ODBC('$DSN'))) {
$cgi->p("Error connecting to Database");
$cgi->p("Error: " . Win32::ODBC::Error ) . " ");
}
my $SqlStatement ='SELECT * FROM Pipeline WHERE Publish<="19 Apr 2006"
+ AND Expiry>="19 Apr 2006" AND CA="Must Read"';
print $SqlStatement;
$db->Sql('$SqlStatement');
I'm still getting this error:
:\Perlcgi\Pipeline\cgi.pl: Can't call method "Sql" on an undefined val
+ue at E:\Perlcgi\Pipeline\cgi.pl line 51.
Line 51 is:
$db->Sql('$SqlStatement');
It's like it won't substitute the contents $SqlStatement or something? Why is that?
Incidentally, if I drop in the SQL Statement in that Line 51 code it still gives the same error message. Does CGI need me to express the $db->Sql() differently?
|