##
my $Check_status = $dbh->prepare("SELECT order FROM items ORDER BY created ASC LIMIT 1");
$Check_status->execute();
my $status = $Check_status->fetchrow();
####
if ($status eq 'no') {
# skip to next row and check
}
####
if ($status eq 'yes') {
# commit changes
# and then continue to check next row
}