F
Faith Greenwood
Hi,
I am making some changes to my mysql table via DBI (I am inserting the
ages of the people I already have in the table). I have the following:
my $sql="UPDATE table SET age=? WHERE name=?";
my $sth=$dbh->prepare($sql);
$sth->execute($age,$name) or warn "$DBI::errstr\n" and next;
my $rc = $sth->rows;
I have 100 records total. Of course, when I run this script the first
time I update the age column of every single person in the table and
$rc=1 for each of the 100 rows. However, running the script the 2nd
time (without changing any of the ages), I still get $rc=1 for each of
the 100 rows (it should be zero, since the row actually wasn't
updated).
To check, I updated a record via phpmyadmin and got 0 rows affected
(like it should). Why is Perl giving me the wrong response? More
importantly, how do I correct it?
thx!
I am making some changes to my mysql table via DBI (I am inserting the
ages of the people I already have in the table). I have the following:
my $sql="UPDATE table SET age=? WHERE name=?";
my $sth=$dbh->prepare($sql);
$sth->execute($age,$name) or warn "$DBI::errstr\n" and next;
my $rc = $sth->rows;
I have 100 records total. Of course, when I run this script the first
time I update the age column of every single person in the table and
$rc=1 for each of the 100 rows. However, running the script the 2nd
time (without changing any of the ages), I still get $rc=1 for each of
the 100 rows (it should be zero, since the row actually wasn't
updated).
To check, I updated a record via phpmyadmin and got 0 rows affected
(like it should). Why is Perl giving me the wrong response? More
importantly, how do I correct it?
thx!