bory has asked for the wisdom of the Perl Monks concerning the following question:
If I have in the database the record "Diana" I want to erase it because it's not an element of the array @test. In the way i do it it deletes all the records from the database. Thank you very much for your time.my @test=("Anna","Maria","Carmen") foreach $line(@test){ my $sth=$dbh->prepare(qq{DELETE FROM tnt WHERE `Name`!=\"$lin +e\"}); $sth->execute(); $sth->finish; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleting from a mysql database
by edan (Curate) on Jan 06, 2004 at 12:08 UTC | |
|
Re: deleting from a mysql database
by jonadab (Parson) on Jan 06, 2004 at 14:25 UTC | |
by bory (Beadle) on Jan 06, 2004 at 15:12 UTC | |
|
Re: deleting from a mysql database
by tachyon (Chancellor) on Jan 06, 2004 at 12:10 UTC | |
by exussum0 (Vicar) on Jan 06, 2004 at 13:02 UTC | |
|
Re: deleting from a mysql database
by mpolo (Chaplain) on Jan 06, 2004 at 14:05 UTC |