Try this global. It will generate a unique list of countries in your database, in the form of a dropdown box. Please note, its not going to be lightning fast, so I wouldn't recommend using it on dynamic pages,....
Code:
sub {
my $table = $DB->table('Links');
$table->select_options('ORDER BY countries');
my $sth = $table->select( 'DISTINCT(countries)' ) || return "$GT::SQL::error";
my $back;
$back .= '<option value="">------</option>';
while (my $hit = $sth->fetchrow_hashref) {
next if !$hit->{countries};
$back .= qq|<option>$hit->{countries}</option>|;
}
return $back;
}
Just call it with <%global_name%>
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!