I had to make some changes to sub view_categories before it would work correctly, so this is my original code. I tried to apply your change, but it wouldn't list any categories at all.
Let me know if you have any other suggestions!
Thanks!
code:
--------------------------------------------
sub view_categories {
# --------------------------------------------------------
# The database manager home page.
&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: List Categories.</title>
</head>
<body bgcolor="#DDDDDD">
<center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 align=ce
nter valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif,Arial,Helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Category List</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>Category List</b></font></center><br>
<center><font size=+0.5>Click on the category you wish to view ads for. The num
ber inside the parenthesis indicates how many ads are in that category.</font>
</center>
<HR>
<font face="Verdana,Arial,Helvetica" size="2"><b>
|;
for ($i = 0; $i <= $#db_cols; $i++) {
if ($db_cols[$i] eq "Category" ) {
$fieldnum = $i; $found = 1;
last;
}
}
if ($found) {
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason
: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
if (!(grep $_ eq $fields[$fieldnum], @selectfields)) {
push (@selectfields, $fields[$fieldnum]);
}
++$count{$fields[$fieldnum]};
}
close DB;
@options = split (/\,/, $db_select_fields{'Category'});
foreach $option (sort @options) {
$cat_link=&urlencode($option);
unless ($count{$option}) {
$count{$option} = '0';
}
print qq|
<a href="$db_script_link_url&Category=$cat_link&view_records=1">$option</a>
($count{$option})<BR>
|;
}
}
print qq|
</b></font>
</p>
|; &html_footer; print qq|
</td></tr>
</table>
</center>
</body>
</html>
|;
}
[This message has been edited by fharris (edited September 12, 1999).]