I want to add a forum through a script. The code I have is
my $f_forum_db = $fdb->table('Forum');
# Add forum in Forum table
$f_forum_db->add ({
forum_id => $forum_id,
cat_id_fk => $cat_id_fk,
forum_name => $forum_name,
forum_desc => $forum_desc,
forum_total => 0,
forum_total_threads => 0,
forum_last => 0,
forum_last_poster => '',
forum_last_id => 0,
forum_sort_rank => 0,
forum_style => 1,
forum_allow_attachments => 1,
forum_allow_guest_attachments => 1,
forum_attachments => 0,
forum_allow_user_edit => 3,
forum_edit_timout => 0,
forum_hard_delete => 2
});When I execute it, it adds a forum, but gives me the error: Can't call method "table" on an undefined value at /.../Forum.pm line 213.
Does anyone know what I have to change/add in order to prevent this error?
BTW, it works fine if I use the "insert" method instead of the "add" method.
Thanks a lot.
Ivan
-----
Iyengar Yoga Resources / GT Plugins
Code:
my $fdb = new GT::SQL '/../admin/defs'; my $f_forum_db = $fdb->table('Forum');
# Add forum in Forum table
$f_forum_db->add ({
forum_id => $forum_id,
cat_id_fk => $cat_id_fk,
forum_name => $forum_name,
forum_desc => $forum_desc,
forum_total => 0,
forum_total_threads => 0,
forum_last => 0,
forum_last_poster => '',
forum_last_id => 0,
forum_sort_rank => 0,
forum_style => 1,
forum_allow_attachments => 1,
forum_allow_guest_attachments => 1,
forum_attachments => 0,
forum_allow_user_edit => 3,
forum_edit_timout => 0,
forum_hard_delete => 2
});
Does anyone know what I have to change/add in order to prevent this error?
BTW, it works fine if I use the "insert" method instead of the "add" method.
Thanks a lot.
Ivan
-----
Iyengar Yoga Resources / GT Plugins