Thanks! The whole code is posted above though some of the appearance parts have changed - that is, the generated HTML. But to see it as it is now, it is pasted in below. There are some remmed out lines were I was trying to fetch the database file's last saved date but that's in another post. I couldn't get it to work either. With the hyperlink type of input that it uses, the search is on the second field [1], which needs to be verbatum and spaces filled with + in the hyperlink but I want to also search via a form, typed in partial or full keyword(s) to search either the third field only [2] or possibly all the fields. Searching all would be nice but searching only on [2] is OK too. Thanks again for your help:
[tt]#!/usr/bin/perl
require "../setup.pl";
$database = "$database/recordings.db";
$querystring = $ENV{'QUERY_STRING'};
# URL example: "discography.cgi?12+inch+LP,1"
# keywords
# convert plus signs to spaces
$querystring =~ tr/+/ /;
($query,$searchfield) = split(/\s*\,\s*/,$querystring,$searchfield);
}
if ( $query ne '*') {
$querytitle = $query
} else {
$querytitle = "All Formats"
}
# ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($database);
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($database);
# use POSIX qw(strftime);
# $now_time = strftime "%a %b %e , %Y at %H:%M:%S", localtime;
@file_attr = stat($database);
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<link rel=stylesheet href=\"$baseurl/style/style.css\" type=\"text/css\">\n";
print "</HEAD>\n\n";
print "<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#0000FF VLINK=#800040 ALINK=#800040>\n";
print "<TITLE>Recordings</TITLE>\n";
print "<CENTER>\n";
# if (-x $database && (($d) = stat(_)) && $d < 0) {
# print "<b>Database size: $size</b><br>\n";
# print "<b>Last modification: </b><br>\n";
# print "<b>Query String: $form{querystring}</b><br>\n";
# print "<b>Keywords: $querystring</b><br>\n";
# }
print "<TABLE width=100\% border=0 cellpadding=0 cellspacing=5>\n";
print "<CAPTION>Recordings / $querytitle<br>\ \;<br></CAPTION>\n";
print "<TR><TD>\n";
print "<a href=\"$baseurl/discography/formats_experimental.html\">Return to the Experimental Database</a><p>\n";
print "</TD></TR>\n";
open(DBRECORDS, "$database"

;
while (<DBRECORDS>){
push @database, [split (/\s*\|\s*/, $_) ];
}
my @sorted =
sort {&sort_fields} @database;
sub sort_fields {
if ($a->[3] cmp $b->[3]) {
return $a->[3] cmp $b->[3]}
elsif ($a->[7] cmp $b->[7]) {
return $a->[7] cmp $b->[7]}
else {
return $a->[1] cmp $b->[1]}
}
foreach (@sorted) {
$listing = "$_->[4],
$_->[5],
$_->[6],
$_->[7],
$_->[8]";
if ($_->[$searchfield] =~ /^$query$/i) {
print "<tr><td>\n";
print "<a href=\"$cgiurl/linkredirect/link_redirect.cgi?link=$_->[10]\">";
print "<i><b>$_->[3]</b></i></a>";
if ($_->[2] ne ""

{
print " <b>($_->[2])</b>";
}
print "<menu>\n";
print "$listing";
print " \($_->[1]\)\n";
print "</menu>\n";
print "</tr></td>\n";
}
}
close (DBRECORDS);
print "</table>\n\n";
print "</body>\n</html>";[/tt]
Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)