Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [Matthias70] Global: List where the users come from?: Edit Log

Here is the list of edits for this post
Re: [Matthias70] Global: List where the users come from?
HI,

I'm just too darn nice Wink

I had to rewrite the whole thing - but it all tests ok my end:

Code:
sub {

my $ignore;
$ignore->{'Place'} = 1;
$ignore->{'Test'} = 1;


use lib '/home/user/domain.com/secure_data/lib';

my $NEWDB = new GT::SQL (
def_path => '/home/user/domain.com/secure_data/defs',
cache => 0,
debug => 0,
subclass => 0
);

my $db = $NEWDB->table('comm_users');
$db->select_options( "GROUP BY prof_city","ORDER BY city_count DESC");
my $sth = $db->select("prof_city", "COUNT(*) as city_count") or die "Query Error: $GT::SQL::error";

my @cities;
while (my ($s, $c) = $sth->fetchrow_array) {
if (length($s) < 2) { next; }
if ($c < 2) { next; }
if ($ignore->{$s}) { next; }
push @cities, { Name => $s, count => $c }
}

return { city_loop_count => \@cities }

}

Call it in the same way as before.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Dec 23, 2007, 4:13 AM

Edit Log: