bazz
11-04-2008, 06:31 PM
Hi,
:confused::confused:
The following sub routine puts the data I need into the db but, the records are not in the ascending order of the PK. The PK autoincremental id could be 345, 347,346.
1. Does this matter?
2. why is it doing it?
3. how would I fix it if I need to?
sub input_room_option_costs {
my $booking_id = $session->param('booking_id');
my %options = % {$session->param('options_data') };
foreach my $chosen_option (sort keys %options)
{
#print qq( chosen_option = $chosen_option<br />
#cost = $options{$chosen_option}
#);
my $insert_options_costs = $bookings_db_connect->prepare("INSERT INTO
tbl_room_bills
(
room_bill_id,
booking_id,
date,
quantity,
description,
cost
)
VALUES ( 'DEFAULT',
'$booking_id',
'',
'',
'$chosen_option',
'$options{$chosen_option}'
)
") or die "prepare statement failed: $DBI::errstr\n";
$insert_options_costs->execute;
}
}
bazz
:confused::confused:
The following sub routine puts the data I need into the db but, the records are not in the ascending order of the PK. The PK autoincremental id could be 345, 347,346.
1. Does this matter?
2. why is it doing it?
3. how would I fix it if I need to?
sub input_room_option_costs {
my $booking_id = $session->param('booking_id');
my %options = % {$session->param('options_data') };
foreach my $chosen_option (sort keys %options)
{
#print qq( chosen_option = $chosen_option<br />
#cost = $options{$chosen_option}
#);
my $insert_options_costs = $bookings_db_connect->prepare("INSERT INTO
tbl_room_bills
(
room_bill_id,
booking_id,
date,
quantity,
description,
cost
)
VALUES ( 'DEFAULT',
'$booking_id',
'',
'',
'$chosen_option',
'$options{$chosen_option}'
)
") or die "prepare statement failed: $DBI::errstr\n";
$insert_options_costs->execute;
}
}
bazz