Greetings !.
I have some problem with executing a SQL update statement while updating
multiple records at a time.
I have tried different ways but it is udating one a single (first) record.
The same sql statement works perfectly when run directly on the MY SQL
prompt.
The code i have used are
1.
@del_list = split(",", $in{del_industry});
foreach $id (@del_list) {
$id= "(industry_id='$id')";
}
$where = join(" or ", @del_list);
$sql ="update industry_list set deleted='y' where ($where)";
$dbh = DBI->connect($site{dsn});
&displayError("Unable to delete the option.<br> $sql")
unless($dbh->do($sql));
# The contents of $sql are "update industry_list set deleted='y' where
((industry_id='001') or (industry_id='002') or (industry_id='003') or
(industry_id='004') or (industry_id='005'))"
2.
$dbh = DBI->connect($site{dsn});
$sql .="update industry_list set deleted='y' where industry_id = ?";
my $sth = $dbh->prepare($sql);
@del_list = split(",", $in{del_industry});
foreach $del_id (@del_list){
$content .= "<br>trying to deleted $del_id";
$sth->execute($del_id);
}
with regards
Rajeev Rumale
___________________________________________________
Yesterday is history. Tomorrow a mystery.
Today is a gift. That's why it's called Present.
___________________________________________________