in reply to Re^2: Perl CGI and SQL statements
in thread Perl CGI and SQL statements
The error message says there are compilation errors and syntax errors at this bracket:use strict; use diagnostics; use CGI qw(:standard); use CGI::Carp qw/fatalsToBrowser/; use Win32::ODBC; use lib '/perlcgi/settings'; require 'settings.pl'; # Included configuration file which contains g +lobal variables my %labels = ( MA => 'Mortgage Advisers', CA => 'Customer Advisers', BM => 'Branch Management', HO => 'Head Office', Acc => 'Accord', MSa => 'MCC Sales', MSe => 'MCC Service', ); my $cgi = CGI->new; my $dept = $cgi->param('department'); my $folderday = '19Apr'; my $SqlStatement ='SELECT * FROM Pipeline WHERE Publish<="$today" AND +Expiry>="$today" AND CA="Must Read"'; my $today = '19 Apr 2006'; print $cgi->header('text/html'); if (defined $dept) { if (exists $labels{$dept}) { # FIXME # untaint $dept and put it into database print $cgi->start_html, $cgi->p("$dept was received."), if ($dept ='CA'){ } # end of IF CA= $cgi->end_html; } else { print $cgi->start_html, $cgi->p("$dept was received, but is not a valid department + name."), $cgi->end_html; }; } else { print $cgi->start_html, $cgi->start_form( -action => $cgi->script_name, ), $cgi->popup_menu( -name => 'department', -values => [keys %labels], -labels => \%labels, ), $cgi->submit, $cgi->end_form, $cgi->end_html; };
} # end of IF CA=
but I think it doesn't like:
if ($dept ='CA'){
What's wrong with that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl CGI and SQL statements
by cdarke (Prior) on Apr 19, 2006 at 11:10 UTC | |
by kjg (Sexton) on Apr 19, 2006 at 12:16 UTC | |
by osunderdog (Deacon) on Apr 19, 2006 at 13:44 UTC | |
by ptum (Priest) on Apr 19, 2006 at 13:33 UTC | |
|
Re^4: Perl CGI and SQL statements
by wfsp (Abbot) on Apr 19, 2006 at 10:43 UTC | |
by kjg (Sexton) on Apr 19, 2006 at 11:26 UTC | |
by osunderdog (Deacon) on Apr 19, 2006 at 11:56 UTC |