Thanks again for your quick reply Lois. I found it where you said I would. I can't seem to get it to work though.
I don't receive any errors, only the search success page with no listings at all. I replaced the three fields and position numbers with mine, but
to no avail. I read it over and over looking for mistakes. Any help in finding my error would be greatly appreciated.
Sorry for the long message.
--Many thanx......Sean
Here is what I have now for those scripts:
sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#
my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);
$page_title = "Search Results";
&html_page_top;
if ($in{'Song_Title'} or $in{$db_key}) {
# Go through each hit and convert the array to hash and send to
# html_record for printing.
if (($db_total_hits == 1) || ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<table>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
}
}
elsif ($in{'Album'}) {
&list_Song_Titles;
}
elsif ($in{'Artist'}) {
&list_Albums;
}
&html_footer;
&html_page_bottom;
}
sub list_Song_Titles {
# --------------------------------------------------------
open (DB, "<$db_file_name") or
&cgierr("error. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$Song_Title_fieldnum = 4; # Change this to match the field number of your Song_Title field
$Album_fieldnum = 5; # Change this to match the field number of your Album field
foreach $line (@lines) {
chomp($line);
@data = &split_decode($line);
if ($data[$Album_fieldnum] eq $in{'Album'}) {
if (!(grep $_ eq $data[$Song_Title_fieldnum], @Song_Title_list)) {
push (@Song_Title_list, $data[$Song_Title_fieldnum]);
}
}
}
foreach $Song_Title (@Song_Title_list) {
$Song_Title_link = &urlencode($Song_Title);
$Album_link = &urlencode($in{'Album'});
print qq|<a href="$db_script_link_url&Album=$Album_link&Song_Title=$Song_Title_link&view_records=1">$Song_Title</a><BR>|;
}
}
sub list_Albums {
# --------------------------------------------------------
open (DB, "<$db_file_name") or
&cgierr("error. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$Album_fieldnum = 4; # Change this to match the field number of your Song_Title field
$Artist_fieldnum = 5; # Change this to match the field number of your Album field
foreach $line (@lines) {
chomp($line);
@data = &split_decode($line);
if ($data[$Artist_fieldnum] eq $in{'Artist'}) {
if (!(grep $_ eq $data[$Album_fieldnum], @Album_list)) {
push (@Album_list, $data[$Album_fieldnum]);
}
}
}
foreach $Album (@Album_list) {
$Album_link = &urlencode($Album);
$Artist_link = &urlencode($in{'Artist'});
print qq|<a href="$db_script_link_url&Album=$Album_link&Artist=$Artist_link&view_records=1">$Song_Title</a><BR>|;
}
}
Here is a portion of my config file: %db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Artist => [3, 'alpha', 50, 255, 1, '', ''],
Song_Title => [4, 'alpha', 50, 255, 1, '', ''],
Album => [5, 'alpha', 50, 255, 0, '', ''],
Date => [1, 'date', 12, 15, 1, &get_date, ''],
Genre => [2, 'alpha', 0, 255, 1, '', ''],
Lyrics => [6, 'alpha', '40x5', 32000, 0, '', ''],
Submitted_By => [7, 'alpha', -2, 50, 0, '', '']
);
# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'ID';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 0;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# Display Benchmarking Information (1 = Yes, 0 = No).
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 0;
# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Genre => 'African,Alternative,Blues,Caribbean,Childrens,Classical,Country,Electronic,Folk and Traditional,Hard Rock,Classic Rock,Soft Rock,Heavy Metal,Industrial,Jazz,Latin,R&B and Soul,Rap,Hip-Hop,Reggae,Religious,',
# Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
);
# Radio fields. Field name => comma seperated list of radio buttons.
# %db_radio_fields = ( Validated => 'Yes,No' );
# Checkbox fields. Field name => Checkbox value.
# %db_checkbox_fields = ( Popular => 'Yes' );
# Default maximum number of hits returned in a search.
$db_max_hits = 110;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 0;
# Regular and title fonts used in auto_generatrion and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';