On 2012-07-18 01:18, Tessio F. wrote:
Hello,
I have an database with a two column primary key:
create database contacts(
username char(20) not null,
contact char(20) not null,
primary key (username, contact)
);
I'm trying to delete a row with the command:
(connect to db..)
my $sth = $dbh->prepare("DELETE FROM contacts
WHERE username=? AND contact=?");
$sth->execute($name, $contact);
But it is not working. To make thing worse, I'm not receiving any error
message either. What is wrong with my code?
Thanks for your time!
Most likely the data is not what you expect it to be.
Test by doing a SELECT first, and see if any row comes out.
Use { PrintError => 0, RaiseError => 1 }
as connect (or $dbh) attributes.
Also:
my $r= $sth->execute( $name, $contact );
print $r;
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/