hello humorlinks,
I have use your modification & it works perfect.
I had one isue, the Full_name of the categories would not displayed.
I have done the following rewrite:
1, changed while in a localvariable called $name & use this fariable in the loop, now i can use something like $name->{Full_Name}
to use this I should use step 2.
2. changed fetchrow_array in fetchrow_hashref
see code below
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table('CatLinks');
my @sids = $db->select ( ['CategoryID'], { 'LinkID' => $id } )->fetchall_list;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select;
my $output;
$output .= "<SELECT CLASS='form' MULTIPLE SIZE='7' NAME='CatLinks.CategoryID'>";
$output .= "<OPTION VALUE=''>---</OPTION>";
while (my $name = $sth->fetchrow_hashref) {
$output .= "<OPTION VALUE='$name->{ID}'";
foreach my $sid (@sids) {
if ($sid eq $name->{ID}) {
$output .= " SELECTED";
}
}
$output .= ">$name->{Full_name}</OPTION>";
}
$output .= "</SELECT>";
return $output;
}
this changes works perfect in my Links-SQL distribution (2.1.1)
I have use your modification & it works perfect.
I had one isue, the Full_name of the categories would not displayed.
I have done the following rewrite:
1, changed while in a localvariable called $name & use this fariable in the loop, now i can use something like $name->{Full_Name}
to use this I should use step 2.
2. changed fetchrow_array in fetchrow_hashref
see code below
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table('CatLinks');
my @sids = $db->select ( ['CategoryID'], { 'LinkID' => $id } )->fetchall_list;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select;
my $output;
$output .= "<SELECT CLASS='form' MULTIPLE SIZE='7' NAME='CatLinks.CategoryID'>";
$output .= "<OPTION VALUE=''>---</OPTION>";
while (my $name = $sth->fetchrow_hashref) {
$output .= "<OPTION VALUE='$name->{ID}'";
foreach my $sid (@sids) {
if ($sid eq $name->{ID}) {
$output .= " SELECTED";
}
}
$output .= ">$name->{Full_name}</OPTION>";
}
$output .= "</SELECT>";
return $output;
}
this changes works perfect in my Links-SQL distribution (2.1.1)