Hi. Im working on a global that will show a list of the categories... it is as follows;
my $category;
my $db = $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select() || return $GT::SQL::error;
while (my ($id,$full_name) = $sth->fetchrow_array) {
my @cut = split /\//, $full_name;
my $back = '';
for (my $i=0; $i < $#cut; $i++) {
$back .= " ";
}
$back .= " " . $cut[$#cut];
}
my $send_back = qq|<select size="1" name="catid"><option value="">------</option>$back</select>|;
return $send_back;
}
The idea of the output would be;
Sub1
Sub2
Another
Sub
Sub
Test
Test2
The problem is, the above global is giving me a 'compilation' error. Can anyone see my stupid mistake? I've been looking over this global for the last couple of hours... and its completly evaded me :(
TIA
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!
Code:
sub { my $category;
my $db = $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select() || return $GT::SQL::error;
while (my ($id,$full_name) = $sth->fetchrow_array) {
my @cut = split /\//, $full_name;
my $back = '';
for (my $i=0; $i < $#cut; $i++) {
$back .= " ";
}
$back .= " " . $cut[$#cut];
}
my $send_back = qq|<select size="1" name="catid"><option value="">------</option>$back</select>|;
return $send_back;
}
The idea of the output would be;
Code:
Name Sub1
Sub2
Another
Sub
Sub
Test
Test2
The problem is, the above global is giving me a 'compilation' error. Can anyone see my stupid mistake? I've been looking over this global for the last couple of hours... and its completly evaded me :(
TIA
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!