I gotta make up a mod for this! Unfortunately, UBB won't search for things other than letters and numbers, so I can't find the previous times that I've given this code.
I'm assuming you want the categories to list on the db home page. If so, in sub html_home, at the beginning, add:
Code:
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>; # Slurp the database into @lines..
close DB;
foreach $line (@lines) {
@data = split (/\Q$db_delim\E/o, $line);
if ($data[
6]) {
++$count{$data[
6]};
++$total_count;
}
}
Be sure to change the
6 above (both places) to the
number of the field that holds the data you want to count.
In the place where you want to print out the information, use
Code:
foreach $type (%count) {
print qq|$type - $count{$type}<BR>|;
}
print qq|Total - $total_count|;
------------------
JPD
[This message has been edited by JPDeni (edited August 09, 1999).]