bazz
09-08-2008, 05:55 PM
Hi,
This really shouldn't be happenin' to me.
Having queried the db for existing room numbers and then, using the form input, I want to insert the numbers which are not already in the db. it will only run one side of the if/else conditional.
foreach my $new_room_number (sort @room_numbers)
{
$select_room_number->execute($business_id, $new_room_number);
while (my @room_numbers = $select_room_number->fetchrow_array)
{
#print qq( @room_numbers ... ); outputs ok
#push(@stored_room_numbers,@room_numbers);
if ($new_room_number == $room_numbers[0])
{
print qq( duplicate $new_room_number <br />); # outputs OK
} else {
print qq(
ndn= $new_room_number <br />
inserted $new_room_number <br />
); # not happening
$insert_into_tbl->execute($business_id, $new_room_number); # not happening either
}
}
}
even if I use 'unless' to force the second half of the if/else, to run, it only runs when the numbers exist so I can;t input new numbers. :(
what am I missing.
bazz
This really shouldn't be happenin' to me.
Having queried the db for existing room numbers and then, using the form input, I want to insert the numbers which are not already in the db. it will only run one side of the if/else conditional.
foreach my $new_room_number (sort @room_numbers)
{
$select_room_number->execute($business_id, $new_room_number);
while (my @room_numbers = $select_room_number->fetchrow_array)
{
#print qq( @room_numbers ... ); outputs ok
#push(@stored_room_numbers,@room_numbers);
if ($new_room_number == $room_numbers[0])
{
print qq( duplicate $new_room_number <br />); # outputs OK
} else {
print qq(
ndn= $new_room_number <br />
inserted $new_room_number <br />
); # not happening
$insert_into_tbl->execute($business_id, $new_room_number); # not happening either
}
}
}
even if I use 'unless' to force the second half of the if/else, to run, it only runs when the numbers exist so I can;t input new numbers. :(
what am I missing.
bazz