Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [Paul] Database Field Advice

Quote Reply
Re: [Paul] Database Field Advice In reply to
Paul,

Thanks for your help.

With my limited experience with plugins and I would appreciate some more advice.

I know how to set up the plugin but I am not sure of the contents. As this plugin will basically do what the add_record subroutine does PLUS split my dates up and add eachone seperatly, I assume that I start by copying the add_record contents into my plugin subroutine. I'm thinking that I need to have the plugin run through all the usual steps for each split date and then display the success page after the last date has be inserted (or an error if applicable).

What I can't work out is where to add my loop to have each split date checked for errors and then inserted. I have modified the loop you gave me and have come up with the following (which works on it's own).

my $splitdate;
my @dates = split ',', $IN->param('public_holiday_202');
foreach $splitdate (@dates) {
$DB->table('public_holiday')->insert({ 'public_holiday_owner_id' => $self->{user}->{Username}, 'public_holiday_104' => $self->{cgi}->{public_holiday_104}, 'public_holiday_105' => $self->{cgi}->{public_holiday_105}, 'public_holiday_201' => $self->{cgi}->{public_holiday_201}, 'public_holiday_202' => $splitdate });
#end for
}


How do I incorporate this loop into my copy of the add_record subroutine???

Am I going about this the wrong way? Is there a simpler way to do this?

Thank you.

Simon.
Subject Author Views Date
Thread Database Field Advice jai 3788 Jan 21, 2003, 3:33 AM
Post Re: [jai] Database Field Advice
jaspercram 3647 Jan 21, 2003, 7:27 AM
Thread Re: [jai] Database Field Advice
Paul 3647 Jan 21, 2003, 8:44 AM
Thread Re: [Paul] Database Field Advice
jai 3622 Jan 24, 2003, 4:09 PM
Thread Re: [jai] Database Field Advice
Paul 3619 Jan 24, 2003, 4:14 PM
Thread Re: [Paul] Database Field Advice
jai 3617 Jan 24, 2003, 5:35 PM
Thread Re: [jai] Database Field Advice
Paul 3632 Jan 24, 2003, 5:46 PM
Post Re: [Paul] Database Field Advice
jai 3590 Jan 26, 2003, 11:15 PM
Post Re: [Paul] Database Field Advice
jai 3580 Jan 28, 2003, 8:59 PM