Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: GROUP BY problems

Quote Reply
Re: GROUP BY problems In reply to
Right on, Drew!! Thank you very much for pointing me in the right direction...I had to adjust the codes slightly to work with LINKS SQL....

index.cgi ==> Forum Display Sub

In Reply To:

sub display {
# --------------------------------------------------------
my ($in, $dynamic) = @_;
my %OUT;
my ($forumcatrec, $forums, $forum_list, $moderator, $output);
my $s = $in->param('s') || $in->cookie('s');
$USER = &authenticate ($s);
my $title_linked = &build_linked_forum_title ("Anthro TECH Discussion Forum");

my $forumcats = '';
my $sth = $FORUMCATDB->prepare ("SELECT * FROM Forum_Cats ORDER BY ForumCatName");
$sth->execute() or die $DBI::errstr;
while (my $forumcatrec = $sth->fetchrow_hashref) {
my $forumcatname = $forumcatrec->{ForumCatName};
my $forum_list = '';
my $sti = $FORUMSDB->prepare ("SELECT * FROM Forum_Topics WHERE ForumCatID = ${$forumcatrec}{ForumCatID} ORDER BY ForumName");
$sti->execute() or die $DBI::errstr;
while (my $forums = $sti->fetchrow_hashref) {
$moderator = $forums->{ModeratorID};
undef $Links::DBSQL::DBH;
my $user = $USERDB->get_record ($moderator, 'HASH');
foreach (keys %$user) {
$forums->{$_} = $user->{$_};
}
$forum_list .= &site_html_forum_link ($forums);
}
$forumcats .= &site_html_forumcat_link ({ForumCatName => $forumcatname, Forum_List => $forum_list});
}
if (defined $USER) {
&site_html_forum_home ({Forums => $forumcats, Username => $USER{Username}, title_linked => $title_linked, %$USER});
}
else {
&site_html_forum_home ({Forums => $forumcats, title_linked => $title_linked});
}
}


And in the forumcatlinks.html file, I added <%Forum_List%> and it worked!

http://www.anthrotech.com/cgibin/forum/

Now, I have to address some efficiency problems since I noticed that when I executed the script, the mysqld was running at 90% WCPU and 90% CPU.

Regards,

Eliot Lee
Subject Author Views Date
Thread GROUP BY problems Stealth 6103 Jul 8, 2001, 3:30 PM
Thread Re: GROUP BY problems
sponge 5960 Jul 8, 2001, 11:35 PM
Thread Re: GROUP BY problems
Stealth 5956 Jul 10, 2001, 5:44 PM
Thread Re: GROUP BY problems
sponge 5962 Jul 10, 2001, 7:53 PM
Thread Re: GROUP BY problems
Stealth 5952 Jul 10, 2001, 8:12 PM
Thread Re: GROUP BY problems
sponge 5947 Jul 11, 2001, 1:41 AM
Thread Re: GROUP BY problems
Stealth 5939 Jul 11, 2001, 4:54 PM
Thread Re: GROUP BY problems
sponge 5904 Jul 21, 2001, 8:20 PM
Thread Re: GROUP BY problems
Stealth 5905 Jul 22, 2001, 9:41 PM
Thread Re: GROUP BY problems
sponge 5902 Jul 22, 2001, 11:41 PM
Post Re: GROUP BY problems
Stealth 5883 Jul 23, 2001, 7:41 AM