15 messages in com.mysql.lists.perlnewbie - updating multiple records.| From | Sent On | Attachments |
|---|---|---|
| Stefano | 10 Jul 2001 07:36 | |
| Adrian Phillips | 10 Jul 2001 08:37 | |
| Jochen Wiedmann | 10 Jul 2001 12:10 | |
| Rajeev Rumale | 10 Jul 2001 18:25 | |
| Stephen Howard | 11 Jul 2001 05:02 | |
| Dodger | 11 Jul 2001 05:38 | |
| Daniel J McDonald | 11 Jul 2001 06:15 | |
| Stephen Howard | 11 Jul 2001 07:14 | |
| Guillaume Denizot | 11 Jul 2001 08:34 | |
| Rajeev Rumale | 11 Jul 2001 18:38 | |
| Todd Finney | 11 Jul 2001 20:20 | |
| Dave Rolsky | 12 Jul 2001 15:09 | |
| Stephen Howard | 12 Jul 2001 15:30 | |
| barries | 13 Jul 2001 07:37 | |
| Dave Rolsky | 13 Jul 2001 12:37 |
| Subject: | newbie - updating multiple records.![]() |
|---|---|
| From: | Rajeev Rumale (raj...@myangel.com) |
| Date: | 07/10/2001 06:25:59 PM |
| List: | com.mysql.lists.perl |
Greetings !.
Hello every one. I am the new member on this list and this is my first posting on this. I beleive that I am positng the question at right place.
I working on a project using Active Perl as developing language and My SQL as database on a win2k server. For database interaction I am using the DBI module.
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); }
After trying all the possible ways I can think of I started having doubts about the DBI's operation.
Kindly advice.
with regards
Rajeev Rumale
___________________________________________________
Yesterday is history. Tomorrow a mystery. Today is a gift. That's why it's called Present.
___________________________________________________




