#!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, $SQLString); $i = 0; $QueryString = $ENV{'QUERY_STRING'}; print "$QueryString"; $DBH = DBI -> connect ('dbi:ODBC:SQLServer', '', '') or die "$DBI::errstr"; $STH = $DBH -> prepare (qq~select Name, Path from dbo.NavigationCategories 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;