ActiveState Community

Perl for ISAPI and query strings.

Posted by Eagle_f90 on 2009-10-27 12:57

I know what your thinking, getting a query string is easy. That is what I though, but it just is not working. Can someone look over this code and tell me what is wrong and why the query string is not being pulled?
#!C:\Perl\bin\PerlEx30.dll -w
use strict;
use DBI;
use CGI q~:standard~;
use CGI::Carp qw(fatalsToBrowser);
my ($DBH, $STH, $QueryString, @SQLResults, @Listing, $i, $MaxArray, $S
+QLString);
$i = 0;
$QueryString = $ENV{'QUERY_STRING'};
print "$QueryString";
$DBH = DBI -> connect ('dbi:ODBC:SQLServer', '', '') or die "$DBI::err
+str";
$STH = $DBH -> prepare (qq~select Name, Path from dbo.NavigationCatego
+ries where Category = '$QueryString'~) or die "$DBI::errstr";
$STH -> execute or die "$DBI::errstr";
while (@SQLResults = $STH -> fetchrow_array) {
$Listing[$i] = qq~$
+SQLResults[0]
~;
$i++;
}
if ($i > 0) {
$MaxArray = $i -1;
$i = 0;
while ($i < $MaxArray) {
$Listing[$i] .= '';
$i++;
}
print "@Listing";
} else {
print "";
}
$DBH -> disconnect;
[download]
When i go to http://www.ffinfo.com/cgi-bin/navigation.plx?Quotes it does not print the query string

Please remember this is perl for ISAPI so I don't need to print headers, also this script will evently be called via SSI in an SHTML page so I don't need to worry about checking the input.