Followings are errors I got after I put everything inside $dbh->prepare() within quotes:
[Wed Apr 11 08:36:30 2007] [error] Bareword found where operator expected at D:/Web/cgi-bin/mihaReport.pl line 1612, near ""CONCAT("SELECT", referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
[Wed Apr 11 08:36:30 2007] [error] \t(Missing operator before SELECT?), referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
[Wed Apr 11 08:36:30 2007] [error] String found where operator expected at D:/Web/cgi-bin/mihaReport.pl line 1613, near "OUTFILE '", DATE_FORMAT( NOW(), '", referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
[Wed Apr 11 08:36:30 2007] [error] \t(Do you need to predeclare OUTFILE?), referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
[Wed Apr 11 08:36:30 2007] [error] Operator or semicolon missing before %Y at D:/Web/cgi-bin/mihaReport.pl line 1613., referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
[Wed Apr 11 08:36:30 2007] [error] Ambiguous use of % resolved as operator % at D:/Web/cgi-bin/mihaReport.pl line 1613., referer:
http://src50.berkeley.edu/cgi-bin/mihaReport.pl
Thanks for your help!